question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow UTC format in configuration

See original GitHub issue

Hello,

The moment adapter by @angular/material-moment-adapter offers a very convenient way of parsing all dates as UTC:

@NgModule({ imports: [MatDatepickerModule, MatMomentDateModule], providers: [ { provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } } ] })

See: https://github.com/angular/material2/blob/master/src/material-moment-adapter/adapter/moment-date-adapter.ts

Would you consider adding a similar option to this library? It would save me a lot of trouble ensuring consistency between locale and UTC dates.

Thanks a lot,

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
DanielYKPancommented, Aug 29, 2018

Update ng-pick-datetime and ng-pick-datetime-moment to latest versions.

Now you could

@NgModule({
  imports: [MatDatepickerModule, MatMomentDateModule], 
  providers: [ { provide: OWL_MOMENT_DATE_TIME_ADAPTER_OPTIONS, useValue: { useUtc: true } } ] 
})
0reactions
annmarie-switzercommented, Feb 26, 2020

Update ng-pick-datetime and ng-pick-datetime-moment to latest versions.

Now you could

@NgModule({
  imports: [MatDatepickerModule, MatMomentDateModule], 
  providers: [ { provide: OWL_MOMENT_DATE_TIME_ADAPTER_OPTIONS, useValue: { useUtc: true } } ] 
})

Hey @DanielYKPan , How can I use this in conjunction with custom formats? I have tried this but it does not work:

providers: [
    { 
        provide: OWL_DATE_TIME_FORMATS, 
	useValue: [{ useUtc: true }, MY_MOMENT_FORMATS ]
    }
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Date in to UTC format Java - Stack Overflow
I am using a ZonedDateTime for the result date-time because it allows us to format it with UTC in the formatted string to...
Read more >
SQL Server: How to save date and time in UTC format
SQL Server: How to save date and time in UTC format. I am developing a small issue management system where all our own...
Read more >
Formatting UTC and Local Dates in Swift
Print, format, and parse UTC and local timezone Dates in Swift. ... Configuring DateFormatter and ISO8601DateFormatter will allow you to ...
Read more >
How to store date, time, and timestamps in UTC time zone with ...
Learn how to store date, time, and timestamps in UTC time zone with JDBC and Hibernate using the hibernate.jdbc.time_zone configuration ...
Read more >
How to Get the Current UTC Date and Time in Java?
In most cases, you should be using the UTC format as it's best supported in Java. How do I set the default locale...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found