datepicker date off by one day

前端 未结 14 842
攒了一身酷
攒了一身酷 2020-12-01 05:22

The date returned by date picker is off by one day. Is it a problem in my code or is it a bug?

The date sent to date_picker is 2012-03-21. The date returned by dat

相关标签:
14条回答
  • Seems to be a bug. If the string sent to Date() is formatted as 2012/03/21 instead of 2012-03-21. The date seems right.

    0 讨论(0)
  • 2020-12-01 05:54

    You can add the difference to the date which will essentially ignore whatever the timezone is.

    d.setTime( d.getTime() + d.getTimezoneOffset()*60*1000 );
    
    0 讨论(0)
提交回复
热议问题