docs: fix incorrect example outputs in addition_subtraction.md#949
Open
frankgoldfish wants to merge 1 commit intopython-pendulum:masterfrom
Open
docs: fix incorrect example outputs in addition_subtraction.md#949frankgoldfish wants to merge 1 commit intopython-pendulum:masterfrom
frankgoldfish wants to merge 1 commit intopython-pendulum:masterfrom
Conversation
The hours and minutes example outputs in the addition/subtraction documentation contained three incorrect values: - add(hours=1) after add(hours=24): '2012-02-25' → '2012-01-29' - subtract(hours=1): '2012-02-29' → '2012-01-29' (also Feb 29 doesn't exist in 2012, it's a leap year but still wrong context) - subtract(minutes=24) after starting at 01:01: '00:00:00' → '00:37:00' Fixes python-pendulum#925
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three example output values in the addition/subtraction documentation are incorrect.
Errors fixed
The example simulates a chain of operations starting from
pendulum.datetime(2012, 1, 28):dt.add(hours=24)→2012-01-29 00:00:00(correct)dt.add(hours=1)→ doc shows'2012-02-25 01:00:00', should be'2012-01-29 01:00:00'dt.subtract(hours=1)→ doc shows'2012-02-29 00:00:00', should be'2012-01-29 00:00:00'(also Feb 29 doesn't exist in 2012, which is a leap year, making this doubly wrong)01:01:00,dt.subtract(minutes=24)→ doc shows'2012-01-28 00:00:00', should be'2012-01-28 00:37:00'(01:01 minus 24 minutes = 00:37)Verified with plain Python
datetimearithmetic.Closes #925