angular / angular/components

Change datepicker parse and display format at runtime

Đang mở
#8,355 23 bình luận 50 reaction 0 người được giao Xem trên GitHub
area: material/datepicker feature 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ả

#### Bug, feature request, or proposal:
Currently the parse and display format of a datepicker can only be set before runtime by providing them with ```provide: MAT_DATE_FORMATS, useValue: MY_DATE_FORMATS```.
As shown in the example: https://material.angular.io/components/datepicker/examples

#### What is the expected behavior?
The parse and display format of the datepicker should also be able to be changed at runtime, the same way it's possible to change the locale at runtime with ```.setLocale()```.
Maybe add ```.setDateFormat(MY_DATE_FORMAT_GENERATED_AT_RUNTIME)```, as sometimes the date format is only available after a HTTP request to the server.

#### What is the current behavior?
Date format is set in provider and cannot be changed at runtime.

#### What is the use-case or motivation for changing an existing behavior?
It should be possible to change the date format at runtime, to be able to react to date-formats, set by the backend. The user can set a preferred date format in the application and the application has to retrieve it from the server and adjust the datepicker accordingly. This is currently not possible.

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

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

Hướng nghiên cứu

Bắt đầu với các ví dụ datepicker của Angular Material và provider MAT_DATE_FORMATS được hiển thị trong issue, sau đó theo dõi cách setLocale() thay đổi hành vi của datepicker. Xác định và kiểm tra một cơ chế runtime để cập nhật các format parse và hiển thị sau phản hồi từ server, bao gồm hành vi अपेक्षित khi format thay đổi.

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
frontend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/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.