day incorrect in angular material datepicker

后端 未结 15 1772
挽巷
挽巷 2020-12-08 11:01

When I select a date I see the correct date in the field but, when I save, the datepicker send the day before the date I have selected ( 3 hours offset ) i am using angular

15条回答
  •  醉梦人生
    2020-12-08 11:14

    Refer to the link here. The easier way is to try below

    var d = new Date('yourDate');
    d.setMinutes( d.getMinutes() + d.getTimezoneOffset() );
    

    d should be the correct date now.

提交回复
热议问题