wanasit / chrono

A natural language date parser in Javascript
MIT License
4.57k stars 341 forks source link

Change whether week beings on monday or sunday #433

Open rien333 opened 2 years ago

rien333 commented 2 years ago

I have an application with an user base that expects weeks to start on a Monday, and end on Sunday, 11:59. Currently, chrono.parse("this week")[0].start always returns a Sunday. Is there any way to change this behavior? Or should I customize the parser/refiner?

More simply put, if today is Tuesday, april the 2th, then "this week" should return Monday, april the 1th (instead of sunday, May the 31th).

Related to https://github.com/wanasit/chrono/issues/252 and https://github.com/wanasit/chrono/issues/291 I think. Feel free to close if you think this is a duplicate.

rien333 commented 2 years ago

Launching chrono with env LANG="nl_NL.UTF-8" LC_TIME="nl_NL.UTF-8 doesn't seem to work unfortunately - even though cal recognizes that, in this locale, weeks start on a monday. (not sure whether chrono reads LC_TIME/LANG anyway, and I'm happy with any fix)