guilima / financial-back

Node API structure connection to postgreSQL / redis
MIT License
4 stars 0 forks source link

feat(moment): Add dependency and change business date with .utc() #12

Closed guilima closed 4 years ago

guilima commented 4 years ago

Tried to use date-fns and encounter problems with utc date. Example:

startOfMonth(new Date('2011-05-31'), 1).toISOString() //"2011-05-01T00:00:00.000Z" OK
startOfMonth(new Date('2011-05-21'), 1).toISOString() //"2011-05-01T00:00:00.000Z" OK
startOfMonth(new Date('2011-05-01'), 1).toISOString() //"2011-04-01T00:00:00.000Z" NOK

This inconsistency, made follow @wagnerssouza suggestion to use moment. It's a bigger lib, but importing only the methods that will be used I belived isn't a burden on the app.

resolves #1