TimeZones.jl icon indicating copy to clipboard operation
TimeZones.jl copied to clipboard

Replace `ZonedDateTime` with parameterized `Localized` type

Open omus opened this issue 7 years ago • 3 comments

When working on #100 there were a couple things I found I would like to adjust. For one there is now:

now() -> DateTime
now(::TimeZone) -> ZonedDateTime

today() -> Date
today(::TimeZone) -> Date

To me the today(::TimeZone) method seems out of place that it returns a Date instead of a ZonedDateTime but it seems odd to return a ZonedDateTime set to midnight to specify an entire day. This makes me think we may want to have a "Zoned" date. I was thinking maybe we want something like: Localized{T<:TimeType} so we could have both Localized{Date} and Localized{DateTime} (would replace ZonedDateTime).

Such an update would be a pretty big change. The change would mean today(::TimeZone) -> Localized{Date} which then we could support +(::Localized{Date}, ::Time) -> Localized{DateTime}.

omus avatar Jan 30 '18 01:01 omus

I definitely need to give this some more thought but this may be worth making a prototype of in the future.

omus avatar Jan 30 '18 01:01 omus

I found a use case for Localized{Time} which is trying to construct a Localized{DateTime} at a specific Time for a provided Date

omus avatar Feb 01 '18 19:02 omus

FWIW, I think Localized{Time} makes more sense to me. How would that work with #127 though? Would we have something like Localized{Time, :strict}?

rofinn avatar Aug 02 '18 19:08 rofinn