Why is the date in datepicker angular showing the last day?

前端 未结 6 752
深忆病人
深忆病人 2021-01-12 13:13

I use datepicker c angular material. Here\'s the code:


 
6条回答
  •  无人及你
    2021-01-12 13:18

    I solve this problem by converting datepicker date value to UTC. Here is example:

    const d = new Date();
    const date = Date.UTC(d.getFullYear(), d.getMonth(), d.getDate());
    

    Maybe it's not elegant way to fix it but help me

提交回复
热议问题