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

Locale Configurable Template Function #49

Closed mgallag closed 9 years ago

mgallag commented 10 years ago

Allow for configurable locale specific template functions. This would allow for more complex range formatting of localized ranges than the current "firstDate - secondDate" format.

e.g. "del 6 - 8 de septiembre del 2014"

icambron commented 9 years ago

@mgallag I actually did a little bit of that in the language files - you'll see that if you include our language file that you get differently formatted output for French. It's sort of a crummy customization interface, though, and my experience helping with Moment.js makes me very much not want to maintain language files.

So I'm open to providing some extra templating options, but it's not obvious how to best set that up; I'm open to suggestions.

Final note is that I experimented a while ago in seeing if I could use the Moment's language specific formatting options to automatically determine the right template, but I haven't finished that yet (some of the progress is here). I'm not sure if that's going to work out, though.