Open dhutaryan opened 5 years ago
I think the following already works (it's relying on MomentDateAdapter internally):
{
provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS,
useValue: { useUtc: true }
}
Actually, the useUtc does not seem to work. Even by providing it in the AppModule (or in another module where the mat-datepicker is imported), the MatDatetimepicker ask to import either the MatNativeDatetimeModule or the MatMomentDatetimeModule or give out this error:
No provider found for DateAdapter. You must import one of the following modules at your application root: MatNativeDatetimeModule, MatMomentDatetimeModule, or provide a custom implementation.
I have created this to replicate the issue: https://stackblitz.com/edit/angular-vesksm-x5zk8x
As you can see, the value in the form is not utc but the local time minus the timezone hours... @kuhnroyal: could you confirm this or maybe is only some misconfiguration..?
Thanks!
Unless I'm misunderstanding how this works, this:
const result = moment({year, month, date, hour, minute});
is the moment being created in local time, meaning the useUtc value is ignored.
Hello,
Please, do you have any update, for me it's the same it's not working...
Thank you
I would like to use time in UTC but I didn't find this functionality.
Could you add such possibility, please?