Skip to content
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

Merged
merged 3 commits into from
Jan 4, 2025

Conversation

simonmcconnell
Copy link
Contributor

It was not obvious that the microsecond precision affects the formatting.

It was not obvious that the microsecond precision affects the formatting.
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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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 :)

## Examples

Microsecond formatting:
Copy link
Member

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. :)

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 | %
Copy link
Member

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!

@josevalim josevalim merged commit 763d0f1 into elixir-lang:main Jan 4, 2025
8 of 9 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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