4 ms·
Ha, I just fixed a similar thing at work right before Christmas. If you use java, consider using google error-prone. It has a check for that (and many other th
by fs111 5y ago
Ha, I just fixed a similar thing at work right before Christmas.
If you use java, consider using google error-prone. It has a check for that (and many other things) https://errorprone.info/bugpattern/MisusedWeekYear https://errorprone.info/bugpattern/MisusedWeekYear
- nicbou 5y agoIs there something similar for Python or JavaScript?
- Cthulhu_ 5y agoeslint 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/
- LinAGKar 5y agoThere is Pylint for Python
- pmulv 5y agoMe too! It's crazy to me that I've never met you or the parent poster but we were living very similar lives the last week of the year due to the same Java DateTime design decision!