cullophid / date-fp

Functional programming date manipulation library
121 stars 17 forks source link

Support week numbers in formatting and parsing #35

Closed TheLudd closed 8 years ago

TheLudd commented 8 years ago

Could this be added? Has it been discussed? I could perhaps take a look at it

cullophid commented 8 years ago

its quite easy to add to formatting. How would it work in parsing ?

TheLudd commented 8 years ago

Don't really know if pasing is neccesary. Just thought it would be symmmetrical. But formatting is where I need it.

cullophid commented 8 years ago

parse( "week WW, YYYY", "week 35, 2016") // ?

TheLudd commented 8 years ago

That would be one possible use and it should give the start of that week I suppose. But perhaps it is for the best to just do formatting and hold off parsing until there are actual requirements.

cullophid commented 8 years ago

its easy enough to add to formatting You are very welcome to do a PR if you like.

https://github.com/cullophid/date-fp/blob/master/src/format.js

all you need to do is add a handler in tokenFunctions

maybe use http://momentjs.com/docs/#/displaying/format/ for reference

If you prefer I can do it over the weekend

TheLudd commented 8 years ago

Think I can do it today

cullophid commented 8 years ago

@TheLudd https://github.com/cullophid/date-fp/pull/36

TheLudd commented 8 years ago

Thanks, sorry I just forgot this...