angular / angular/components

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

Đang mở
#32,935 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/datepicker docs P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Mở trang tổng quan datepicker bị ảnh hưởng và so sánh ví dụ LuxonDateAdapter trên đó với mã nguồn adapter được liên kết tại src/material-luxon-adapter/adapter/index.ts. Xem xét PR hiện có và cập nhật tài liệu để cấu hình được mô tả khớp với API được hỗ trợ, đồng thời thiết lập UTC được ghi trong tài liệu là chính xác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.