-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove moment as a dependency #11
Remove moment as a dependency #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Souler Great job! I had a plan to remove 'moment' or keep it as peer deps. a while ago.
Here you can find a few refinement suggestions, could you please apply them and update all tests. once you do that, ping me to move forward!
@3imed-jaberi I went ahead and addressed the naming suggestion and the unnecesary variable on However I find myself arguing against the other two proposed changes (the object-map for months, and the array for joining the time). Happy to discuss them further so we can find an agreement. |
For as simple as this
koa-accesslog
is; bringing moment into the dependency tree just to format a date felt a bit overkill.This PR replaces moment with a local minimal implementation only with en support.
Why not using Intl?
Intl availability on runtime depends on how the node binary was built and how the process running was started (you can read more here). Since I did not want to couple the library to a specific icu setup; I decided to implement the minimal required code for the date formatting needs of the library.
## Would this be a breaking change?
To be honest: I'm not 100% sure. I have tried to keep the implementation as close as possible to what we had; but this PR would change how the short month is rendered for non-en configured systems. Not a big deal; but worht considering when decieding.
It is also worth noting this PR is indepentent from #10 but they would create a conflict with eachother because of the changes in the
package-lock.json
in the other PR.