Small problem with new datefield

Small problem with new datefield

Edwin1966Edwin1966 Posts: 9Questions: 4Answers: 0

I use DataTables-1.10.10 with Editor-PHP-1.5.2.
I love the new calender date picker but I have a small problem.

All works OK in the examples but when I use

format: 'DD-MM-YYYY'

the date I select is very often changed to one day later in the container.

I also use:

//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/locale/nl.js
moment.locale('nl-NL'); 

Thanks, Edwin

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi Edwin,

    Thanks for pointing this out! This is an error in the output of the date when in a timezone that observes day light saving time, when selected a date during which day light saving is active and using MomentJS as the formatter. It should be using UTC for the output but is not...

    The fix is fortunately quite simple - search the Editor code for:

    window.moment( date, undefined, this.c.momentLocale, this.c.momentStrict ).format( this.c.format );

    and replace with:

    window.moment.utc( date, undefined, this.c.momentLocale, this.c.momentStrict ).format( this.c.format );
    

    The addition of .utc is all that is required.

    This will be in Editor 1.5.3 which I expect to release in the next couple of weeks to address a couple of little issues like this.

    Regards,
    Allan

  • Edwin1966Edwin1966 Posts: 9Questions: 4Answers: 0

    Thanks for the quick fix Allen!

This discussion has been closed.