:datetime with constraints vs :utc_datetime_usec

Hey all, I’m looking at the docs for the different datetime options and they mention >A wrapper around :datetime for backwards compatibility https://hexdocs.pm/ash/Ash.Type.UtcDatetimeUsec.html In a new project with the latest version of Ash what is the most appropriate way to define a timestamp with microsecond precision? Should I prefer:
attribute :xx, :datetime do
constraints precision: microsecond
end
attribute :xx, :datetime do
constraints precision: microsecond
end
Or
attribute :xx, :utc_datetime_usec
attribute :xx, :utc_datetime_usec
I don’t quite understand what the implication of the “warning” about backward compatibility is :/
Solution:
They are equivalent and will likely not change anytime soon. Someday we may warn when you use :utc_datetime_usec over the constraint.
Jump to solution
2 Replies
Solution
ZachDaniel
ZachDaniel4mo ago
They are equivalent and will likely not change anytime soon. Someday we may warn when you use :utc_datetime_usec over the constraint.
ZachDaniel
ZachDaniel4mo ago
likely starting in 4.0

Did you find this page helpful?