dayjs
dayjs copied to clipboard
Feature Request - Calendar plugin texts should be part of locale
Describe the bug Wrong/missing translation on calendar pluging to spanish language
Expected behavior Parsing a date using UTC, adjusting it using timezone and translating using locale to "es" (spanish) i was expecting to translate a same date as "hoy a las" instead to "Today at"
As workaround i used the method below:
dayjs().calendar(null, {
sameDay: '[hoy a las] h:mm A', // The same day ( Today at 2:30 AM )
sameElse: 'DD/MM/YYYY' // Everything else ( 7/10/2011 )
})
Information
- Day.js Version: v1.11.3
- OS: Debian Sid / Debian 5.18.2-1 (2022-06-06)
- Browser: Firefox Developer Edition 102.0b7
- Time zone: GMT-04:00
You are right: the calendar plugin texts are not part of the localization (but for sure should be).
So IMHO this is a feature request (perhaps you should change the title to something like 'feature request - calendar plugin texts should be part of locale'. And perhaps you want / could create a pull request at least for spanish 😄
I just had the same problem. happy to provide translations in german if needed as soon as the infrastructure is there :)
i just found this issue: https://github.com/iamkun/dayjs/issues/1068 it seems that was a deliberate decision?
I would interpret the last comment in this issue as @iamkun is not against localizing these texts (as long as the size of the bundle is not significantly increased. So perhaps it is worth a try. Perhaps I will find the time to do some experiments.
Thanks for reply and suggestions @BePo65
I will try to make PR for spanish