facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Other
4.05k stars 723 forks source link

Support for Hijri Dates (Islamic Calendar) #99

Open Abdallatif opened 6 years ago

Abdallatif commented 6 years ago

I was wondering if there is any plan to support the conversion from Hijri dates to duckling default dates (Gregorian Calendar) if so when will it be available to use?

ex: 7th Safar, 1439h -> 27th October, 2017

patapizza commented 6 years ago

Hi @Abdallatif,

If I understand correctly, you're looking for parsing Hijri dates in English and resolve/convert them to the Gregorian calendar. Is it possible to do this by adding rules? Do things like "2 days before 7th Safar, 1439h" make sense?

On another hand, if you're also looking for the other way around (resolve/convert Gregorian dates to Hijri), this would require another set of changes (might be part of the assumptions framework: #29).

Abdallatif commented 6 years ago

Hi @patapizza

Thanks for replying, I'm looking for a way to resolve Hijri to Gregorian dates. The conversion is not that simple.

I think this should be a helper rather than a rule. Because there are some holidays that are in Hijri calendar, like Eid-ul-Fitr which is on 1st Shawwal, and 1st of Shwwal is not on the same Georgian dates every year, for 2018 it's on 15th of Jun (estimated), but in 2017 it was on 25th of June. Each month starts when the lunar crescent is first seen.

There are some formulas to estimate the Hijri dates to Georgian dates php code