Support `Temporal` across Node.js APIs
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.4k
- Merge trung bình
- 4 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 272
Mô tả
The Temporal proposal is currently Stage 3, has in progress / experimental implementation in V8 (available in latest releases using --harmony-temporal), and is likely to be unflagged in Node.js once it's stable enough (refs: https://github.com/nodejs/node/issues/57127, https://github.com/nodejs/node/pull/57128).
In light of this, I propose that Node.js begins supporting Temporal in the relevant APIs (mainly those that already work with Dates) after it becomes available by default without runtime flag.
Relevant APIs:
-
fs:StatsandBigIntStats
Only bigint version provides nanosecond precision, and both provide lazy getters forDateinstances. Adding lazy getters forTemporal.Instantwould also make non-bigint version provide nanosecond precision. -
fs:utimes(),lutimes(),futimes(),utimesSync(),lutimesSync(),futimesSync(),promises.utimes(),promises.lutimes(),filehandle.utimes()
Acceptsatimeandmtimeasnumber|string|Date, can supportTemporal.Instantas well.
Note: these functions also don't acceptbigints yet. In the Temporal API,numbers are used forepochTimes in milliseconds whilebigints are used for nanoseconds. Adding direct support ofbigints might result a confusing API: some users might expect it to coerce type and behave exactly the same asnumber|string, some might expect it to be parsed as nanoseconds. AddingTemporalsupport would make it unambiguous.
Maybe there are other APIs that can benefit from this, too?
cc @nodejs/fs since it's only https://github.com/nodejs/node/labels/fs at the moment.
Internal updates (if it happens to be more precise, more fast, or more readable), generic support (primordials, util, assert, etc.) and dependencies (for example, undici.setCookie(, { expires })) are out of scope here.
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.
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các API fs được liệt kê, cách xử lý Date hiện có của chúng, cùng đề xuất Temporal và các tài liệu tham chiếu Node.js được liên kết. Xác định phạm vi API được hỗ trợ và các yêu cầu tương thích trước khi thay đổi bất kỳ điều gì; hoàn thành có nghĩa là phần hỗ trợ Temporal đã thống nhất được triển khai và được bao phủ bởi các bài kiểm thử fs liên quan, mặc dù ở đây không nêu tên tệp hoặc bài kiểm thử cụ thể nào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, nodejs
- Lĩnh vực
- api, operating-systems
- 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
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100