effect icon indicating copy to clipboard operation
effect copied to clipboard

Add time zone support to `Cron` apis

Open fubhy opened this issue 1 year ago • 3 comments

What is the problem this feature would solve?

https://github.com/Effect-TS/effect/pull/1884 introduced support for cron expressions. However, there's currently no way to specificy a time zone that the cron schedule should be relative to.

What is the feature you are proposing to solve the problem?

Add simplistic time zone support if at all possible (we all know how horrible the Date API is).

What alternatives have you considered?

... Skip this and live with the limitation.

The existing cron-like Schedule APIs (e.g. Schedule.dayOfWeek) also currently don't support time zones.

If we end up adding this for Schedule.cron, we should also add it to those.

fubhy avatar Jan 09 '24 15:01 fubhy

@fubhy I have built a Timezone type for this. I am testing it now. Do you have a preference for how it integrates into Cron, dayOfWeek, ...

As an optional parameter to Cron.match, Cron.next, Schedule.dayOf???, ... ? A chainable (ala moment) Cron.match().timezone("America/NewYork")?

Something else?

PaulJPhilp avatar Jan 15 '24 21:01 PaulJPhilp

@fubhy I have built a Timezone type for this. I am testing it now. Do you have a preference for how it integrates into Cron, dayOfWeek, ...

As an optional parameter to Cron.match, Cron.next, Schedule.dayOf???, ... ? A chainable (ala moment) Cron.match().timezone("America/NewYork")?

Something else?

I think an optional parameter to Cron.match, etc. would be good.

fubhy avatar Jan 15 '24 22:01 fubhy

Great. I’ll have a PR ready in the next few days.

On Mon, Jan 15, 2024 at 5:04 PM Sebastian Lorenz @.***> wrote:

@fubhy https://github.com/fubhy I have built a Timezone type for this. I am testing it now. Do you have a preference for how it integrates into Cron, dayOfWeek, ...

As an optional parameter to Cron.match, Cron.next, Schedule.dayOf???, ... ? A chainable (ala moment) Cron.match().timezone("America/NewYork")?

Something else?

I think an optional parameter to Cron.match, etc. would be good.

— Reply to this email directly, view it on GitHub https://github.com/Effect-TS/effect/issues/1887#issuecomment-1892811272, or unsubscribe https://github.com/notifications/unsubscribe-auth/BA6V6ZWRKNZPVUKD6KO6Z23YOWRWDAVCNFSM6AAAAABBTJW5LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJSHAYTCMRXGI . You are receiving this because you commented.Message ID: @.***>

PaulJPhilp avatar Jan 15 '24 22:01 PaulJPhilp