icambron / twix.js

:hourglass::left_right_arrow: A date range plugin for moment.js
https://isaaccambron.com/twix.js/
MIT License
379 stars 54 forks source link

Internationalization (Swap places for month and date) #86

Closed timbrandin closed 8 years ago

timbrandin commented 8 years ago

Switching order depending on locale, "en" => month first, other locale => month after (solves most of all needs). Isn't it odd that Americans and just a few others put month before the date: https://en.wikipedia.org/wiki/Date_format_by_country

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 97.872% when pulling f06cbcc1103d7938f504462f279b1c9d68172f9e on studiointeract:master into 23b1639a05a245fc00995da034ff5c962bfa71de on icambron:master.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 97.872% when pulling 6ebcd13a5f2ae4f0b3a203071a6d2f30ae99ae13 on studiointeract:master into 23b1639a05a245fc00995da034ff5c962bfa71de on icambron:master.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 97.872% when pulling 6ebcd13a5f2ae4f0b3a203071a6d2f30ae99ae13 on studiointeract:master into 23b1639a05a245fc00995da034ff5c962bfa71de on icambron:master.

icambron commented 8 years ago

Thanks for writing this. I have two concerns.

  1. It uses the global Moment locale, but it should probably use the locale of the start date, since you can set the locale on individual Moment objects.
  2. I'm not completely sure that the en is the only locale where these slots should be that way.

Could we do something like this?

americanish = (m) ->
  f = m.localeData()._longDateFormat["L"]
  f.indexOf("M") < f.indexOf("D")

and then check that?

timbrandin commented 8 years ago

Sounds like a great plan, I'll add that.

icambron commented 8 years ago

Closing in favor of #89. @timbrandin I'd appreciate your comments there.