0

How do I get the first day of the week (sunday or monday) for the current locale in haskell?

old-locale gives me the days of the week, but in string form. I also don't find anything in the time library.

I would prefer if it was a function already included in base, that I would not need to install a new external library.

Emmanuel Touzery
  • 9,008
  • 3
  • 65
  • 81

1 Answers1

2

I guess you'll have to write that function yourself. From this answer:

From CLDR's supplemental data:

<firstDay day="mon" territories="001 AD AI AL AM AN AT AX AZ BA BE BG BM BN BY CH CL CM CR CY CZ DE DK EC EE ES FI FJ FO FR GB GE GF GP GR HR HU IS IT KG KZ LB LI LK LT LU LV MC MD ME MK MN MQ MY NL NO PL PT RE RO RS RU SE SI SK SM TJ TM TR UA UY UZ VA VN XK" />
<firstDay day="fri" territories="BD MV" />
<firstDay day="sat" territories="AE AF BH DJ DZ EG IQ IR JO KW LY MA OM QA SD SY" />
<firstDay day="sun" territories="AG AR AS AU BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IE IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP NZ PA PE PH PK PR PY SA SG SV TH TN TT TW UM US VE VI WS YE ZA ZW" />
<firstDay day="sun" territories="GB" alt="variant" references="Shorter Oxford Dictionary (5th edition, 2002)" />

(Territory 001 is "World")

Community
  • 1
  • 1
mb21
  • 34,845
  • 8
  • 116
  • 142
  • well that's disappointing :-( It does seem to be a black hole in OS locale settings. also in C: http://stackoverflow.com/a/11353103/516188 and also in javascript, it seems it's handled manually by moment.js instead of raw JS. I'll leave the question open a bit longer in case someone comes up with some hackage library doing that, and if noone provides a nicer solution, I'll award you the answer. – Emmanuel Touzery Dec 26 '15 at 10:46