cRonstrue icon indicating copy to clipboard operation
cRonstrue copied to clipboard

add timezone to output of cronstrue.toString

Open greyscaled opened this issue 3 years ago • 2 comments
trafficstars

Summary

It would be nice-to-have an option in Options

https://github.com/bradymholt/cRonstrue/blob/3c94b7ea0c90f9be79a0e49d20a465f2fc3a87d3/src/options.ts#L1-L8

such as withTimezone?: string that would allow us to add a timezone to the output.

So for example:

30 9 * * 1-5

and withTimezone: "EDT"

could produce a string like:

At 09:30 EDT on every day-of-week from Monday through Friday.

The idea here isn't that cronstrue needs to know anything about timezones, but allow a pass-through.

LMK if you think there's a sufficient workaround with the existing API, or if this type of string pass-through is not desired.

Thanks :wave: :tada: !

greyscaled avatar Jun 09 '22 17:06 greyscaled

I now see #94 and am inclined to believe this one is somewhat of a dupe, with just an opinionated suggestion.

greyscaled avatar Jun 09 '22 17:06 greyscaled

I like it! I would suggest an option name that would not confuse it with actually doing timezone translation. So, maybe withTimezoneSpecifier. I would welcome a PR for this.

bradymholt avatar Jun 09 '22 17:06 bradymholt

Not directly what is being asked for but in https://github.com/bradymholt/cRonstrue/pull/288 a tsOffset option has been added which may help indirectly with this request. I think there is still opportunity to add an option for the timezone name to the output.

bradymholt avatar Aug 09 '23 14:08 bradymholt