Rule proposal: `prefer-temporal`
See original GitHub issueThe Temporal proposal is currently stage 3. It massively improves date and time handling in JavaScript.
There’s a lot of potential for linting here.
We could block use of Date
completely. Would probably have to be behind an option. But as far as I know, Temporal
should cover everything Date
currently handles.
Fail
Date.now()
Pass
Temporal.now.instant()
We could also potentially prevent use of popular date libraries like moment
, Luzon
, date-fns
, etc.
More specific ideas for listing here wanted.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Proposed rule: Order Competition Rule
proposed rule would prohibit a restricted competition trading center from internally executing certain orders of individual investors at a ...
Read more >SEC's Proposed Preferential Treatment Rule
Notably, the Preferential Treatment Rule would apply to all private fund advisers (including those exempt from registration) and their related ...
Read more >FCA consultation on availability of information in the IPO process
Investment banks and lawyers responded that simultaneous publication would be unlikely to be deliverable and they would prefer temporal separation between the ...
Read more >Agenda for the 86th meeting of Ecma TC39 - 2021
Agenda topic rules · Such proposals must link to supporting materials prior to the deadline, or else delegates may object to advancement solely ......
Read more >draft-jennings-rtcweb-signaling-00
RTCWeb Offer/Answer Protocol (ROAP) (Internet-Draft, 2011) ... The offer answer model specifies rules for the bilateral exchange of Session Description ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
On second thought, why? Why would
Temporal.Now.instant().epochMilliseconds
be better thanDate.now()
? It’s just a number in both cases and there are no improvements (unlike the newNumber.*
methods).I think such rule would make more sense for every
Date
method exceptDate.now()
Luckily we don’t have to decide this yet. We can make the option false at first and see how we feel about it after having used Temporal for a while.