docs-bug(datepicker): Wrong docs for parsing dates as UTC with luxon
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
### 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:
>
> ```ts
> bootstrapApplication(MyApp, {
> providers: [provideLuxonDateAdapter(undefined, {useUtc: true})]
> });
> ```
[`provideLuxonDateAdapter()` only takes the 1 parameter](https://github.com/angular/components/blob/46b67d15053ce31b4742b809f1777b32eb2f1863/src/material-luxon-adapter/adapter/index.ts#L32-L34), 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](https://github.com/angular/components/pull/32936) copying the Moment adapter.
The current actual way to achieve it is:
```ts
bootstrapApplication(MyApp, {
providers: [
provideLuxonDateAdapter(),
{
provide: MAT_LUXON_DATE_ADAPTER_OPTIONS,
useValue: {
useUtc: true,
} satisfies Partial,
},
]
});
```
### Affected documentation page
https://material.angular.dev/components/datepicker/overview#choosing-a-date-implementation-and-date-format-settings
Beitragsleitfaden
Rechercherichtung
Öffne die betroffene Datepicker-Übersichtsseite und vergleiche ihr LuxonDateAdapter-Beispiel mit der verlinkten Adapter-Quelle unter src/material-luxon-adapter/adapter/index.ts. Überprüfe den bestehenden PR und aktualisiere die Dokumentation so, dass die beschriebene Konfiguration der unterstützten API entspricht und die dokumentierte UTC-Einrichtung korrekt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 25/100