bpo-34158: Documentation UTC offset update#8377
Conversation
Since changes in the UTC offset that allows sub-minute offsets, the documentation needs update: - "%z" format code documentation update Karthikeyan Singaravelan commented on bugs.python.org: Added as part of 018d353 and a fix regarding duplicate words for that part was added at bac2d5b. Relevant format string at https://github.com/python/cpython/pull/2896/files#diff-25e2d173c84057d069b7890450714eddR214. Relevant test case with 6-digit string for microsecond : https://github.com/python/cpython/pull/2896/files#diff-acc40bec51c7de832de3361db3edae52R309. Table at https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior could also be updated with microseconds being optional in the second column %z | UTC offset in the form ±HHMM[SS] (empty string if the object is naive). | (empty), +0000, -0400, +1030 - isoformat documentation update According to me, needs confirmation: Relevant format string at https://github.com/python/cpython/pull/4699/files#diff-25e2d173c84057d069b7890450714eddR176 Relevant test case at https://github.com/python/cpython/pull/4699/files#diff-25e2d173c84057d069b7890450714edd
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. When your account is ready, please add a comment in this pull request Thanks again for your contribution, we look forward to reviewing it! |
|
CLA signed. |
| If :meth:`utcoffset` does not return ``None``, a string is | ||
| appended, giving the UTC offset: | ||
| YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM[:SS[.uuuuuu]] or, if :attr:`microsecond` | ||
| is 0 YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.uuuuuu]]. |
There was a problem hiding this comment.
Would be more consistent to use mmmmmm rather than uuuuuu.
Since you are introducing square brackets, you could eliminate the second form and just write [.mmmmmm] for both time and offset parts.
There was a problem hiding this comment.
Well, I used 'u' from the '%z' format code.
And it sounds better to me ('u' for 'micro') than 'm' which usually stands for 'milli'
There was a problem hiding this comment.
Hm, we are wildly inconsistent in this document.
From the fromisoformat documentation (which I wrote 😳):
Specifically, this function supports strings in the format(s)
YYYY-MM-DD[*HH[:MM[:SS[.mmm[mmm]]]][+HH:MM[:SS[.ffffff]]]],
where*can match any single character.
That uses both fff and mmm in the same format string.
moment.js uses SS for fractional seconds, but I find that very confusing.
I think that f is most consistent with the %f notation in str{f,p}time, and avoids the question of whether it should be [.mmm[.uuu]].
From @pganssle: using f for fractional part of seconds in all file.
|
Thanks @christopheNan for the PR, and @abalkin for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
* Documentation of UTC offset update Since changes in the UTC offset that allows sub-minute offsets, the documentation needs update: - "%z" format code documentation update Karthikeyan Singaravelan commented on bugs.python.org: Added as part of 018d353 and a fix regarding duplicate words for that part was added at bac2d5b. Relevant format string at https://github.com/python/cpython/pull/2896/filesGH-diff-25e2d173c84057d069b7890450714eddR214. Relevant test case with 6-digit string for microsecond : https://github.com/python/cpython/pull/2896/filesGH-diff-acc40bec51c7de832de3361db3edae52R309. Table at https://docs.python.org/3.7/library/datetime.htmlGH-strftime-and-strptime-behavior could also be updated with microseconds being optional in the second column %z | UTC offset in the form ±HHMM[SS] (empty string if the object is naive). | (empty), +0000, -0400, +1030 - isoformat documentation update According to me, needs confirmation: Relevant format string at https://github.com/python/cpython/pull/4699/filesGH-diff-25e2d173c84057d069b7890450714eddR176 Relevant test case at https://github.com/python/cpython/pull/4699/filesGH-diff-25e2d173c84057d069b7890450714edd * From Martin Panter: some style improvment; From @pganssle: using f for fractional part of seconds in all file. (cherry picked from commit 9287882) Co-authored-by: Christophe Nanteuil <35002064+christopheNan@users.noreply.github.com>
|
GH-9732 is a backport of this pull request to the 3.7 branch. |
* Documentation of UTC offset update Since changes in the UTC offset that allows sub-minute offsets, the documentation needs update: - "%z" format code documentation update Karthikeyan Singaravelan commented on bugs.python.org: Added as part of 018d353 and a fix regarding duplicate words for that part was added at bac2d5b. Relevant format string at https://github.com/python/cpython/pull/2896/filesGH-diff-25e2d173c84057d069b7890450714eddR214. Relevant test case with 6-digit string for microsecond : https://github.com/python/cpython/pull/2896/filesGH-diff-acc40bec51c7de832de3361db3edae52R309. Table at https://docs.python.org/3.7/library/datetime.htmlGH-strftime-and-strptime-behavior could also be updated with microseconds being optional in the second column %z | UTC offset in the form ±HHMM[SS] (empty string if the object is naive). | (empty), +0000, -0400, +1030 - isoformat documentation update According to me, needs confirmation: Relevant format string at https://github.com/python/cpython/pull/4699/filesGH-diff-25e2d173c84057d069b7890450714eddR176 Relevant test case at https://github.com/python/cpython/pull/4699/filesGH-diff-25e2d173c84057d069b7890450714edd * From Martin Panter: some style improvment; From @pganssle: using f for fractional part of seconds in all file. (cherry picked from commit 9287882) Co-authored-by: Christophe Nanteuil <35002064+christopheNan@users.noreply.github.com>
Since changes in the UTC offset that allows sub-minute offsets, the documentation needs update:
"%z" format code documentation update
Karthikeyan Singaravelan commented on bugs.python.org:
Added as part of 018d353 and a fix regarding duplicate words for that part was added at bac2d5b.
Relevant format string at https://github.com/python/cpython/pull/2896/files#diff-25e2d173c84057d069b7890450714eddR214.
Relevant test case with 6-digit string for microsecond : https://github.com/python/cpython/pull/2896/files#diff-acc40bec51c7de832de3361db3edae52R309.
Table at https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior could also be updated with microseconds being optional in the second column
%z | UTC offset in the form ±HHMM[SS] (empty string if the object is naive). | (empty), +0000, -0400, +1030
isoformat documentation update
According to me, needs confirmation:
Relevant format string at https://github.com/python/cpython/pull/4699/files#diff-25e2d173c84057d069b7890450714eddR176
Relevant test case at https://github.com/python/cpython/pull/4699/files#diff-acc40bec51c7de832de3361db3edae52R1734
https://bugs.python.org/issue34158