Parsing an ISO Date String into a Zoned DateTime with a Known Timezone

Hi Effect community!
I am trying to parse a date ISO string that has no timezone indication into a DateTime.Zoned instance. I know the timezone in advance.
Conceptually, I would like something like:
const str = "2025-03-24T11:00:00"
const tz = "Europe/Paris"
const date = Schema.decodeOption(TheSchema(tz))(str)
expect(date).toEqual(DateTime.makeZonedFromString("2025-03-24T11:00:00+01:00[Europe/Paris]"))

I also want the behavior not to depend on the local timezone ^^

I tried to use Schema.transformOrFail and I think I got something working, but I wonder if there is something else either builtin or simpler.

Here's my code: https://effect.website/play#aa91becfdd18
Was this page helpful?