angular / angular/components

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

未关闭
#32,935 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/datepicker docs P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### 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

贡献指南

打开贡献指南

调研方向

打开受影响的 datepicker 概览页面,并将其中的 LuxonDateAdapter 示例与链接到的适配器源代码 src/material-luxon-adapter/adapter/index.ts 进行比较。查看现有的 PR,并更新文档,使所描述的配置与受支持的 API 相匹配,并确保文档中记录的 UTC 设置准确无误。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
documentation
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。