Open KevinNovak opened 6 years ago
@KevinNovak I see what you're saying, let me think a bit about it. Anyway, you can always call toDate()
on a CronDate
to get the actual Date
.
Just got bit by this as well! The return format doesn't bother me, but it would be nice if it was correctly documented -- the typings mark the return value of nextInvocation()
as a Date
too.
Any updates on this? Seems like the returned object is a Moment date. In typescript i have to cast it as any and then call .toDate() to get a real Date object
Just got bit by this as well! The return format doesn't bother me, but it would be nice if it was correctly documented -- the typings mark the return value of
nextInvocation()
as aDate
too.
This! It cost me an hour to figure out why it is documented as Date
but loses all time precision.
I was attempting to format and print out the next invocation date of a job, and noticed that nextInvocation() returns a CronDate instead of a standard JavaScript Date, which makes it difficult to format without converting or including the cron-parser package . Unless there is a reason to return CronDate, I think it would be better for users to have a standard Date returned. (This might also apply to other methods too).
Example:
Output:
Is there a reason we return a CronDate as opposed to a regular Date?