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

Formatting years prior to 1000 with %F should produce four digits for year, not three. #236

Open
lukfugl opened this issue May 1, 2015 · 0 comments
Assignees

Comments

@lukfugl
Copy link

lukfugl commented May 1, 2015

Timezone claims to format dates "with a full implementation of strftime formats, including the GNU date extensions." The stftime man page describes %F as "equivalent to %Y-%m-%d (the ISO 8601 date format)." There is, however, ambiguity here when dealing with years prior to 1000. The man page also describes %Y as "the year as a decimal number including the century." But ISO 8601 "prescribes, as a minimum, a four-digit year [YYYY]."

I am ambivalent about whether %Y should be changed to always include four digits. Some languages (e.g. ruby) treat %Y as a CCYY value even for single digit centuries, others as variable width; in python, a century less than 1000 is raised as an error. I believe it is appropriate to see "May 1, 900" as the output for the format string %b %-e, %Y on a date of 0900-05-01, but would already see "May 1, 0900" from ruby anyways.

However, I believe if %Y remains variable width, %F's ambiguity should be resolved in the direction of conforming to ISO 8601 rather than conforming to equivalence with %Y-%m-%d. %F is primarily used as a machine-oriented format string (particularly when generating ISO 8601 strings). Without an ISO 8601 compliant %F, there is no format string that can be provided to produce an ISO 8601 output.

@bigeasy bigeasy added this to the Slippin' Into the Future milestone May 1, 2015
@bigeasy bigeasy self-assigned this May 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants