day incorrect in angular material datepicker

后端 未结 15 1879
挽巷
挽巷 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:24

    If you want to use it in your component, you can simply do

    pipe = new DatePipe('en-US'); // Use your own locale
    

    Now, you can simply use its transform method, which will be

    const now = Date.now();
    const myFormattedDate = this.pipe.transform(now, 'short');
    

提交回复
热议问题