3 ms·
eslint is the de facto standard for Javascript, there may be rules or plugins to check for date formatting rules.
by Cthulhu_ 5y ago
eslint is the de facto standard for Javascript, there may be rules or plugins to check for date formatting rules.
- nicoburns 5y agoThere is no date formatting in JavaScript's standard library. External libraries tend to just fix this kind of thing with a breaking change.
- JimDabell 5y agoThere is – here’s the spec: https://tc39.es/ecma402/#datetimeformat-objects https://tc39.es/ecma402/#datetimeformat-objects
- nicoburns 5y agoAh yes. I can't use that yet due to lack of browser support so I forgot it existed.
- JimDabell 5y agoIt’s pretty well supported now – even Internet Explorer 11 has partial support. But if you need it, there’s a polyfill here: https://formatjs.io/docs/polyfills/intl-datetimeformat/ https://formatjs.io/docs/polyfills/intl-datetimeformat/