Skip to content

bpo-34158: Documentation UTC offset update#8377

Merged
abalkin merged 2 commits intopython:masterfrom
christopheNan:datetime_37
Oct 5, 2018
Merged

bpo-34158: Documentation UTC offset update#8377
abalkin merged 2 commits intopython:masterfrom
christopheNan:datetime_37

Conversation

@christopheNan
Copy link
Copy Markdown
Contributor

@christopheNan christopheNan commented Jul 21, 2018

Since changes in the UTC offset that allows sub-minute offsets, the documentation needs update:

https://bugs.python.org/issue34158

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
@the-knights-who-say-ni
Copy link
Copy Markdown

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
and a Python core developer will remove the CLA not signed label
to make the bot check again.

Thanks again for your contribution, we look forward to reviewing it!

@christopheNan
Copy link
Copy Markdown
Contributor Author

CLA signed.

Comment thread Doc/library/datetime.rst Outdated
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]].
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Member

@pganssle pganssle Jul 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Comment thread Doc/library/datetime.rst
@abalkin abalkin merged commit 9287882 into python:master Oct 5, 2018
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @christopheNan for the PR, and @abalkin for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 5, 2018
* 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>
@bedevere-bot
Copy link
Copy Markdown

GH-9732 is a backport of this pull request to the 3.7 branch.

ned-deily pushed a commit that referenced this pull request Oct 6, 2018
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants