Git Product home page Git Product logo

Comments (4)

robstoll avatar robstoll commented on July 28, 2024

I think the following already works (it's relying on MomentDateAdapter internally):

{
    provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS,
    useValue: { useUtc: true }
}

from mat-datetimepicker.

sgabb avatar sgabb commented on July 28, 2024

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!

from mat-datetimepicker.

ShaneLillieRAD avatar ShaneLillieRAD commented on July 28, 2024

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.

from mat-datetimepicker.

hamouda06 avatar hamouda06 commented on July 28, 2024

Hello,

Please, do you have any update, for me it's the same it's not working...

Thank you

from mat-datetimepicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.