Daterangepicker in the culture and the old version of some initialization problems, can not select a second problem __date

Source: Internet
Author: User
Tags locale
$ (' #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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.