Add constructors for Date / Time components using type-level integers
Chưa có ai nhận issue này.
- #97 của @JordanMartinez — đã đóng, không merge
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 15/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend
Hướng nghiên cứu
Start with the proposed type-level constructors in the issue and the exactDate API; the issue identifies type-level leap-year validation and a Prim.Int (class Mod) as prerequisites. Read the discussion and linked pull request #97 to see what was attempted. Done means providing a DateTime constructor that validates the day for its month and year at the type level.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With the advent of 0.15.0 and type-level integers, we can now define Date and Time components without using unsafePartial:
hour
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 24 PO.LT
=> Proxy i
-> Hour
hour p = Hour $ reflectType p
minute
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 60 PO.LT
=> Proxy i
-> Minute
minute p = Minute $ reflectType p
second
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 60 PO.LT
=> Proxy i
-> Second
second p = Second $ reflectType p
millisecond
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 1_000 PO.LT
=> Proxy i
-> Millisecond
millisecond p = Millisecond $ reflectType p
year
:: forall i
. Reflectable i Int
=> PI.Compare i (-271821) PO.GT
=> PI.Compare i 275760 PO.LT
=> Proxy i
-> Year
year p = Year $ reflectType p
month
:: forall i
. Reflectable i Int
=> PI.Compare i 0 PO.GT
=> PI.Compare i 13 PO.LT
=> Proxy i
-> Month
month p = unsafePartial $ fromJust $ toEnum $ reflectType p
day
:: forall i
. Reflectable i Int
=> PI.Compare i 0 PO.GT
=> PI.Compare i 32 PO.LT
=> Proxy i
-> Day
day p = Day $ reflectType p
I would like to add a similar constructor for DateTime based on exactDate, but that requires verifying at the type-level that the day is within the bounds for the month-year combination. If we wanted to lift the isLeapYear function to the type-level, it seems we'll need a Prim.Int (class Mod) type class.
- Ngôn ngữ chính
- PureScript
- Star
- 51
- Fork
- 48
- Merge trung bình
- 2 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của purescript/purescript-datetime
-
Week number of the YearĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
purescript/purescript-datetime#102 · 5 bình luận ·
-
type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
purescript/purescript-datetime#92 · 1 bình luận ·
-
status: needs more info
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
purescript/purescript-datetime#90 · 3 reaction ·
-
Addjust by Month, YearĐang mởstatus: needs more info
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
type: enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 24/100
purescript/purescript-datetime#79 · 6 bình luận · 1 reaction ·
Tất cả issue của purescript/purescript-datetime
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
remove the use of `forget`Đang mởgood first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
milind-soni/OpenMausBot#5829 ·
Maintainer thường phản hồi trong vòng 1 ngày