$ (' #headlineAddForm #rangeTime '). Daterangepicker ({showdropdowns:true, timepicker:true,//whether to display hours and minutes Timepicker24hour:true, timepickerincrement:1,//time increment, per minute timepickerseconds:true, Lin Kedcalendars:false, Locale: {format: Yyyy-mm-dd HH:mm:ss,//date format from and to displayed in the control SEPA Rator: "-", Applylabel: "OK", Cancellabel: "Cancel", Fromlabel: "Start", to Label: "End", Customrangelabel: "Custom", Weeklabel: "W", DaysOfWeek: ["Day", "one", "two", "
Three "," four "," Five "," VI "], monthnames: [" January "," February "," March "," April "," May "," June "," July "," August "," September "," October "," November "," December "], Firstday:1}}, function (Start, end, label) {$ ("#headlineAddForm #startTime"). Val (start
. UNIX ());
$ ("#headlineAddForm #endTime"). Val (End.unix ()); }. On (' Hide.daterangepicker ', function () {$ (' #headlineAddForm '). datA (' Bootstrapvalidator '). UpdateStatus (' rangetime ', ' not_validated ', null). Validatefield (' rangetime ');
}. On (' Cancel.daterangepicker ', function () {$ (' #headlineAddForm #rangeTime '). Val (""); $ (' #headlineAddForm '). Data (' Bootstrapvalidator '). UpdateStatus (' rangetime ', ' not_validated ', null). Validatefield (
' Rangetime ');
. On (' Apply.daterangepicker ', function () {if ($.trim ($ ("#headlineAddForm #startTime"). Val ()). Length = = 0) {
$ (' #headlineAddForm #rangeTime '). Val (""); $ (' #headlineAddForm '). Data (' Bootstrapvalidator '). UpdateStatus (' rangetime ', ' not_validated ', null). Validatefield (
' Rangetime '); }
});
$ (' #headlineModifyForm #rangeTime '). Daterangepicker ({showdropdowns:true, timepicker:true,//whether to display hours and minutes
Clock Timepicker24hour:true, timepickerincrement:1,//time increment, unit for minute timepickerseconds:true,
Linkedcalendars:false, Locale: {format: Yyyy-mm-dd HH:mm:ss,//date format from and to displayed in the control
Separator: "-", Applylabel: "OK", Cancellabel: "Cancel", Fromlabel: "Start", Tolabel: "End", Customrangelabel: "Custom", Weeklabel: "W", DaysOfWeek: ["Day", "one", "two "," three "," four "," five "," six "], MonthNames: [" January "," February "," March "," April "," May "," June "," July "," August "," September "," October "," November "," December " "], firstday:1}}, function (Start, end, label) {$ (" #headlineModifyForm #startTime "). VA
L (Start.unix ());
$ ("#headlineModifyForm #endTime"). Val (End.unix ()); }. On (' Hide.daterangepicker ', function () {$ (' #headlineModIfyform '). Data (' Bootstrapvalidator '). UpdateStatus (' rangetime ', ' not_validated ', null). Validatefield (' Rangetime ')
; });
Datarangepicker use the latest version of internationalization, but in the update operation does not seem to put the initialization in the editing echo data, here do not know why, in the use of the old version of the Daterangepicker can be initialized in the Echo data, Use the new version of the time will be reported bootstrapvalidator error (here I used the echo when the following code
$ (' #headlineModifyDiv '). On (' Show.bs.modal ', function () {
$ (' #headlineModifyForm '). Bootstrapvalidator (' Resetform ', false;
});
And it's always a bootstrapvalidator mistake.
Therefore, when updating the initialization of the Daterangepicker, that is, not when the data back to initialize the Datarangepicker component.
You need to reassign date values to date controls at the time of editing.
$ ("#headlineModifyForm #rangeTime"). Data (' Daterangepicker '). Setstartdate (Getlocaltime (Row.starttime));
$ ("#headlineModifyForm #rangeTime"). Data (' Daterangepicker '). Setenddate (Getlocaltime (row.endtime));
This will be able to use the latest version of the choice of seconds function, the old version of seemingly can not select seconds.
Many other projects in the date of conversion to write their own functions, in fact, the use of Daterangepicker when the author used the Moment.js, this moment.js with a lot of formatting date of operation, completely do not have to go behind closed doors to build wheels