-
Notifications
You must be signed in to change notification settings - Fork 15
Return environment variable as a date object #13
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
base: master
Are you sure you want to change the base?
Conversation
Hi @ledleds, glad to hear you find this library useful! I like the idea of being able to handle dates more easily. And I also think the code quality of your patchset is really good! However I'm a bit reluctant with respect to adding a dependency ( Do you see any chance of extracting the logic behind |
url: url.parse | ||
url: url.parse, | ||
date: function(value) { | ||
if (dayjs(value).isValid()) { |
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.
It would be great if we could find a way to do this without adding a comparably large dependency like dayjs (dayjs is much bigger than this library so it feels odd to add it as a first and only dependency).
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.
Yeah makes total sense. I'll look at how the dayjs
library does the validation and see if its a simple replication or find some other way of validating!
Swapping Moment out for Dayjs may make sense. Dayjs has the same interface as Moment but is only 2kb: https://github.com/iamkun/dayjs |
I still would love to keep this basic module free of external dependencies |
@ledleds @jshjohnson any interest from your end of picking this up again and providing an implementation that works without adding dependencies? |
Thanks for this library, we find it very useful!
We sometimes have dates as environment variables and have been checking that when a date is given that it is valid everywhere we use your library. I thought maybe others could be doing this also so it might be useful to be within the library itself!
The new
date
function uses another librarydayjs
for date validation and returns a date object with the given value.Please let me know what you think!