dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Feature Request - Calendar plugin texts should be part of locale

Open holic-cl opened this issue 2 years ago • 6 comments

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

holic-cl avatar Jun 15 '22 03:06 holic-cl

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 😄

BePo65 avatar Jun 26 '22 05:06 BePo65

I just had the same problem. happy to provide translations in german if needed as soon as the infrastructure is there :)

therealshark avatar Jun 27 '22 01:06 therealshark

i just found this issue: https://github.com/iamkun/dayjs/issues/1068 it seems that was a deliberate decision?

therealshark avatar Jun 27 '22 09:06 therealshark

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.

BePo65 avatar Jun 27 '22 10:06 BePo65

Thanks for reply and suggestions @BePo65

I will try to make PR for spanish

holic-cl avatar Jun 28 '22 20:06 holic-cl