locked
Why my date is one day behind ui.bootstrap datepicker? RRS feed

  • Question

  • User2108892867 posted

    Hello everyone I used ui.bootstrap datepicker to select date. However when I select 25/05/2018, my model (angular js) show as 2018-05-24T22:09:36.675Z. Here is the image of the result

    https://www.screencast.com/t/9pUezPWN

    And here is the clip

    https://www.screencast.com/t/6Vaq13rD

    I reckon this has to do with conversion to UTC date. How could I keep my date as is like the selection? 

    Thanks

    Thursday, May 24, 2018 10:56 PM

All replies

  • User1724605321 posted

    Hi asplearning ,

    You can refer to this answer : https://stackoverflow.com/a/37850342/5751404 :

    ng-model-options="{timezone: 'UTC'}" 

    Note: Use this only if you are concerned about the date being 1 day behind & not bothered with extra time of T00:00:00.000Z

    Best Regards,

    Nan Yu

    Friday, May 25, 2018 6:18 AM