Skip to content

Conversation

@am-kantox
Copy link
Contributor

This PR provides syntactic sugar for date/time sigils as shown below

# ~U[]s
DateTime.truncate(DateTime.utc_now(), :second)

# ~T[]m
Time.truncate(Time.utc_now(), :millisecond)

# ~D[]
Date.utc_today()

@josevalim
Copy link
Member

Can you please send this up for discussion on the mailing list? I wouldn’t merge it for the empty sigil though. I would prefer ~D[today] or similar, but even then I am not convinced, especially because sigils are often compilation time, so some may expect it to mean the date it was compiled.

Thanks!

@josevalim josevalim closed this Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants