Dayjs: non Georgian calendars

Created on 26 Apr 2018  Â·  9Comments  Â·  Source: iamkun/dayjs

We have many types of calendars that use in many countries.
https://github.com/unicode-cldr/cldr-core/blob/218129a0ead6f82b1b7e4c146e4264f3b475c303/supplemental/calendarPreferenceData.json

Any plan for implementation ?

discussion

Most helpful comment

@behnoodk We are doing this. May be will release in next minor release. Won't too long!

All 9 comments

I'm not familiar with the concept of non Gregorian calendar. Any detailed information?

More detailed on JS:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
Example:

console.log(new Intl.DateTimeFormat('fa-IR-u-ca-persian').format(new Date()));

Browser support:
http://kangax.github.io/compat-table/esintl/

php version with intl extension:

$fmt = datefmt_create(
    'fa_IR@calendar=persian',
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'Asia/Tehran',
    IntlDateFormatter::TRADITIONAL,
    'EEEE d MMMM yyyy HH:mm' // as ISO_8601
);

echo datefmt_format($fmt, time()) . "\n"; // // پنجشنبه ۱۰ اردیبهشت ۱۳۹۴ ۱۲:۱۲

All of them implement icu library that process datetime based on locale and calendars:
http://userguide.icu-project.org/datetime/calendar

Debian dev package:
https://packages.debian.org/sid/libicu-dev

I see. Seems not a widely used feature. If I am wrong, please let me know.

We might could add features like this into a plugin, not our core module.

Base on icu data first calendar system on:
https://github.com/unicode-cldr/cldr-core/blob/218129a0ead6f82b1b7e4c146e4264f3b475c303/supplemental/calendarPreferenceData.json

Afghanistan 37 million people use persian
Iran 82 million people use persian
Saudi Arabia 33 million people use islamic-umalqura
Thailand 69 million people use buddhist.
and other countries has another calendars systems.
this population about 220 million people around world for the first different calendar system.

Also for multiple calendar system also:
Japanese use second calendar japanese and South Korea use dangi and etc...

So for the library for used widely on many applications why we dont ignore many places in world ?

I don't get it, why world think we have 1 language 1 calendar 1 text direction ...
We need movement for embrace whole world data process. JavaScript implement I18n so late but good, and many developers, such as UI/UX developers need to consider the I18n, l10n.

We might could add features like this into a plugin, not our core module.

It's a good idea. Moment supports Persian calendar through a plugin.
@iamkun is there an established way to write a plugin for dayjs? How one may go about writing a plugin for dayjs? I couldn't find anything in the docs.

It's good to have plugin, but in many framework libraries developer path the datatime processing into main process. but with simplest design of datetime based on i18n and l10n, actually we cant see any libraries with good design.

We need a simple repo to tell whole developers that we exist with non-Georgian, no LTR direction.

In most libraries RTL, i18n, l10n is patch or 3rd party.
bootstrap 3 not have rtl also v4 not implemented ...
if developer consider rtl exist it will be simple config.
https://github.com/twbs/bootstrap/issues/19545

@behnoodk We are doing this. May be will release in next minor release. Won't too long!

I'll close this issue since it's been a while, and there is already a plugin supports jalili calender in github.
Feel free to reopen if you have updates on this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fundon picture fundon  Â·  5Comments

antony picture antony  Â·  5Comments

axelg12 picture axelg12  Â·  4Comments

oliv9286 picture oliv9286  Â·  4Comments

vaquel picture vaquel  Â·  3Comments