Post AYBohrMqpYTgCWmapM by userquin@m.webtoo.ls
(DIR) More posts by userquin@m.webtoo.ls
(DIR) Post #AY7bUVxZd6hIYCDojw by patak@m.webtoo.ls
2023-07-27T13:57:14Z
0 likes, 0 repeats
It seems that you can call `format` on `Intl.DateTimeFormat` without arguments and it has the same effect:```jsconst timeFormatter = new Intl.DateTimeFormat()// Same effecttimeFormatter.format(new Date())timeFormatter.format()```MDN isn't clear about this though. Is it better to be explicit here? Does someone has a reference to how this API works exactly with no params?https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format
(DIR) Post #AY7dtpSqRx3iBr30Ay by cheeaun@mastodon.social
2023-07-27T14:24:12Z
0 likes, 0 repeats
@patak it says `locales (optional)` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#parametersAnd there's this site for testing https://www.intl-explorer.com/DateTimeFormat
(DIR) Post #AY7eJCoWm03HqcI1rM by demivan@fosstodon.org
2023-07-27T14:28:49Z
0 likes, 0 repeats
@patak It is part of the spec: https://tc39.es/ecma402/#sec-datetime-format-functionsBut I would still pass date explicitly.
(DIR) Post #AY7hUxZvXme1vukzr6 by patak@m.webtoo.ls
2023-07-27T15:04:34Z
0 likes, 0 repeats
@demivan Yes, I'm thinking the same. Thanks for the reference!
(DIR) Post #AYBohrMqpYTgCWmapM by userquin@m.webtoo.ls
2023-07-29T14:44:10Z
0 likes, 0 repeats
@patak You can check the spec here: https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype.formatIn 4.a entry you have a link to DateTime Format Functions (11.5.4): https://tc39.es/ecma402/#sec-datetime-format-functionsIn previous link check the entry 3.a