-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add note about microsecond precision in Calendar.strftime #14137
add note about microsecond precision in Calendar.strftime #14137
Conversation
It was not obvious that the microsecond precision affects the formatting.
lib/elixir/lib/calendar.ex
Outdated
B | Full month name | January | ||
c | Preferred date+time representation | 2018-10-17 12:34:56 | ||
d | Day of the month | 01, 31 | ||
f | Microseconds (truncated to the microsecond precision, but *does not support width and padding modifiers*) | 000000, 999999, 0123 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please expand exactly what this means? We cannot have higher precision than microseconds for calendar types, so saying it is truncated is in a way correct, but not because of formatting. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If microseconds has precision 6, it prints 6 digits. If it is 3 it prints 3, i.e. milliseconds. I'll add a better explanation when I'm back at the computer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we say: "(always uses its precision for width/padding)"? Then below we can add a line or paragraph with more information :)
lib/elixir/lib/calendar.ex
Outdated
## Examples | ||
|
||
Microsecond formatting: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this to the end or middle of examples, we should not start with it. :)
lib/elixir/lib/calendar.ex
Outdated
Y | Year | -0001, 0001, 1986 | ||
z | +hhmm/-hhmm time zone offset from UTC (empty string if naive) | +0300, -0530 | ||
Z | Time zone abbreviation (empty string if naive) | CET, BRST | ||
% | Literal "%" character | % |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please make sure we only change a single row in the table? :) Thank you!
💚 💙 💜 💛 ❤️ |
It was not obvious that the microsecond precision affects the formatting.