Return environment variable as a date object#13
Return environment variable as a date object#13ledleds wants to merge 4 commits intoctavan:masterfrom
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.
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.
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
datefunction uses another librarydayjsfor date validation and returns a date object with the given value.Please let me know what you think!