Angular UI DatePicker adjusting for timezone

前端 未结 6 612
忘了有多久
忘了有多久 2020-12-08 04:19

I have a date stored as a Date in SQL Server. The date shows 4/24/2014 when I query in SQL. That is correct. The date is correctly brought over to the client side in UTC. To

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 05:07

    For me, because we use a very old version of the library, and given an object expiration_date returned by the datepicker, I had to find a workaround and tweaked it like that :

    expiration_date.setMinutes(-expiration_date.getTimezoneOffset());
    

    Which will set the requested date to its corresponding UTC date but still expressed in local timezone format.

    For me it worked well. Hope it can help someone.

提交回复
热议问题