Open NicHaley opened 4 years ago
Hi, you can pass specifying calendar output formats as the second parameter. https://day.js.org/docs/en/display/calendar-time
We don't have a conclusion about whether to bundle the calendar locale inside or let our users passed in right now, it might not worth doing this because it's not a very important locale part.
You can check some of our previous discussion https://github.com/iamkun/dayjs/pull/570
Thanks for sharing the link! For now I will add on my own, but to add my two cents I don't think adding the calendar keys would increase the bundle size an appreciable amount. Additionally, I assume most apps don't require every locale. Ours for example uses 28 locales, and we only dynamically import locales when needed. The difference in gzipped bundle size for each locale would only be a few bytes.
Alternatively, as you suggested in the previous thread even having a part and full version for each locale would be useful.
Agreed. Will see if there's something we could do to improve this.
Curious if there's been any traction here? This feels like a bit gotcha for folks trying to migrate off of a moment.js.
At the very least, it would be nice to have some sort of suggested guidelines on handling overrides. Particularly, it's not clear to me how we should handle Spanish when the moment locales use a function instead of a string:
https://github.com/moment/moment/blob/develop/locale/es.js#L70-L90
Describe the bug Not a bug but a feature request. The day.js locales only have a small subset of the data compared to MomentJS. This can result in unexpected behaviour when migrating from MomentJS to day.js.
For example, consider the
de
translations for day.js and MomentJS. MomentJS has calendar values. This makes it possible to output things like "Tomorrow at 12:30pm".Expected behavior Day.js should provide the same locale data as MomentJS.
Information