Feat: Useful.now_str/1
a simple string representation of the DateTime
e.g: "2022-05-17 04:20"
#13
Labels
chore
a tedious but necessary task often paying technical debt
enhancement
New feature or request
help wanted
Extra attention is needed
priority-2
Second highest priority, should be worked on as soon as the Priority-1 issues are finished
research
Research required; be specific
T1h
Time Estimate 1 Hour
Context
I just want a simple function that I can use to display the full human friendly date + time in my logs or UI.
e.g: "2022-04-20 04:20"
Why does it have to be so hard?! 🤷♂️
At present in
Elixir
(v1.13
latest), the nativeDateTime
library doesn't have an easy way of doing this.here are the docs for the
DateTime.html.now!/2
function:Why? 🤷♂️
Why on earth does a
DateTime
library not have sensible defaults?!Why do I need to give a
time_zone
andtime_zone_database
just to use this function?!Why does a person who is
new
toElixir
have to read documentation to understand this?!At present this is how I'm forced to do it:
The problem is this is
UTC
("Coordinated Universal Time") which I don't care about because it's not adjusted for daylight saving time i.e. behind by 1 hour.What I want is:
The timezone could be optional.
e.g:
But it could also be inferred from where the computer running the code or the user viewing the page is!!
Research/Reading
ElixirConf 2019 - Date, Time, and Time Zones in Elixir 1.9 - Lau Taarnskov: https://youtu.be/_E988mvPIzU
This forum thread: https://elixirforum.com/t/ecto-and-timezones/3276 suggests: https://github.com/lau/calecto
Which in turn uses: https://hexdocs.pm/calendar/readme.html
The text was updated successfully, but these errors were encountered: