Duration: ISO 8601 format/parse and a Schema codec (exact units only)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- api
Hướng nghiên cứu
A working branch (feat/duration-iso) and open PR #9891 already implement the proposed Duration.formatIso, fromIso and Schema.DurationFromIsoString. Review that PR and the issue's exact unit rules, then check output against Temporal.Duration#toString(). Coordinate with the existing contributor before doing further work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is the problem this feature would solve?
v3 had Duration.formatIso, Duration.fromIso and Duration.unsafeFormatIso (#4343, for #4319). v4 dropped them, and the migration guide says to "retain a local formatter" or use a separate ISO parser.
ISO 8601 durations are a common wire format: OpenAPI format: duration, config files (timeout: PT30S), Temporal.Duration#toString(). In v4 each app needs its own parser, and there is no Schema codec.
v3 also treated a year as 365 days and a month as 30 days, so P1M was wrong for most months.
What is the feature you are proposing to solve the problem?
Duration.formatIso(self: Duration): Option<string>
Duration.fromIso(input: string): Option<Duration>
Schema.DurationFromIsoString // string <-> Duration, JSON Schema format: "duration"
- Exact units only:
W,D,H,M(afterT),S. A day is 24 hours. Yand monthMare rejected, since they have no fixed length.- Optional sign, fraction on the last time unit only, up to 9 digits.
- Output matches
Temporal.Duration#toString():P1DT2H3M4.5S,PT0S,-PT1.5S. - Infinite durations give
Option.none()(and an encode failure in the codec).
What alternatives have you considered?
- A local helper in each app, which is what the migration guide suggests.
Duration.fromInput(Temporal.Duration.from(s)), but Node 24 has noTemporalwithout a flag, and it gives no Schema codec.
I have a working branch with tests (checked against Temporal.Duration where available): https://github.com/jayhemnani9910/effect/compare/main...feat/duration-iso. I can open a PR if this direction is OK.
- Ngôn ngữ chính
- TypeScript
- Star
- 16.7k
- Fork
- 808
- Merge trung bình
- 10 giờ 33 phút
- Pull request đã merge (30 ngày)
- 830
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 Effect-TS/effect
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RpcServer: with disableFatalDefects, a handler that throws before returning its Effect still fails every pending callCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#9892 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HttpApiClient: `Redacted` query and header values appear in plain text in client spansCó thể đã có người làm @effect-bot đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Effect.fn stack frames keep the call's arguments alive in forked fibersCó thể đã có người làm @Hona đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
cli: fallback prompts should fail instead of waiting when no one can answerCó thể đã có người làm @effect-bot đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Effect-TS/effect
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
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 85/100
farion1231/cc-switch#8829 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverĐang mởdoc-audit enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/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 85/100
-
neon functions new: Next: hint says to export env vars for neon dev, but dev loads .env.localĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
neondatabase/neon-pkgs#941 ·
Maintainer thường phản hồi trong vòng 1 ngày