Date, Time, Datetime?

In the API we have * https://ash-hq.org/docs/module/ash/latest/ash-type-date * https://ash-hq.org/docs/module/ash/latest/ash-type-time * https://ash-hq.org/docs/module/ash/latest/ash-type-utcdatetime It looks as if both :date and :time default to UTC/ISO calendar, so I got a little confused by the naming. I wonder: is the fact it's UTC actually part of the type? Or might it make sense just to have :date, :time, and :datetime, and specify that the representation of these is in UTC/ISO, in the same way that :string specifies the type and UTF-8 is the representation?
2 Replies
ZachDaniel
ZachDaniel•2y ago
Yes, I think it would be better to have :datetime, exactly as you say 🙂 We mostly copied the ecto patterns, and that type has existed for a long time, well before our type constraints system was as evolved as it is now so attribute :due_date, :datetime, constraints: [timezone: :utc] (that would likely be the default) This might be a good thing to do for the 3.0 release in the next few months we will have a few small breaking changes for that release, so it will be good to group them up If you'd like to open an issue on ash core I can tag it appropriately/put it on the 3.0 milestone, or I can open one 🙂
pragdave
pragdaveOP•2y ago
Assuming ash core is ash-project/ash, 'tis done.

Did you find this page helpful?