Return environment variable as a date object
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 library dayjs for date validation and returns a date object with the given value.
Please let me know what you think!
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 (dayjs) which is much more complex than this tiny library on its own just for the sake of being able to parse/validate dates which will add.
Do you see any chance of extracting the logic behind dayjs().isValid() and inline it directly in this library here?
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 . If you could inline the relevant functionality I‘d be happy to merge.
@ledleds @jshjohnson any interest from your end of picking this up again and providing an implementation that works without adding dependencies?