Skip to content

docs-bug(datepicker): Wrong docs for parsing dates as UTC with luxon #32935

@StavNoyAkur8

Description

@StavNoyAkur8

Documentation Feedback

The docs include this extract:

By default the LuxonDateAdapter creates dates in your time zone specific locale. You can change the default behaviour to parse dates as UTC by passing useUtc: true into provideLuxonDateAdapter:

bootstrapApplication(MyApp, {
  providers: [provideLuxonDateAdapter(undefined, {useUtc: true})]
});

provideLuxonDateAdapter() only takes the 1 parameter, no second options with useUtc.

My guess is this is a holdover from Moment, which does have this option.
It would be nice, and fairly easy, to actually have this same option.
edit: I went ahead and made a PR copying the Moment adapter.

The current actual way to achieve it is:

bootstrapApplication(MyApp, {
  providers: [
    provideLuxonDateAdapter(),
    {
      provide: MAT_LUXON_DATE_ADAPTER_OPTIONS,
      useValue: {
        useUtc: true,
      } satisfies Partial<MatLuxonDateAdapterOptions>,
    },
  ]
});

Affected documentation page

https://material.angular.dev/components/datepicker/overview#choosing-a-date-implementation-and-date-format-settings

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: material/datepickerdocsThis issue is related to documentationgemini-triagedLabel noting that an issue has been triaged by geminineeds triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions