Repository navigation
Conversation
Several documented outputs cannot be produced by the current code: - attributes_properties.md: 2012-09-05 is a Wednesday, so day_of_week is WeekDay.WEDNESDAY (2) now that the week starts on Monday at 0, and it is day 249 of the (leap) year, not 248. - duration.md: the total_*() and in_*() values were computed for days=1177 only, but the `it` in that section also has years=2 and months=3. in_days() already showed 1997; the other values now match. - string_formatting.md: the format() example used HH with A, which gives "14:15:16 PM"; hh gives the documented 02:15:16. In strftime(), %t is a tab, not an ordinal suffix. to_iso8601_string() uses a colon in the offset (-05:00). - difference.md and the Date/DateTime.diff_for_humans() docstrings: future values relative to now read "in 1 hour", not "1 hour from now", and a 5 second difference is "in a few seconds". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NQDmA3mwGfL83pbg9WQ6ey
This branch has not been deployed
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.
Pull Request Check List
This only changes documentation (four docs pages and two docstrings), so there are no new tests.
I ran the examples in the docs against master and found some outputs that the current code can't produce. Each fix below was checked by running the code on master (e06dace) with Python 3.13.
attributes_properties.md
pendulum.parse('2012-09-05T23:26:11.123789').day_of_weekreturns<WeekDay.WEDNESDAY: 2>. The docs showed3, which was the old Sunday-based numbering.day_of_yearfor that date is249(2012 is a leap year, andstrftime('%j')agrees). The docs showed248.duration.md
The
itin the "Properties and Duration Methods" section isduration(years=2, months=3, days=1177, seconds=7284, microseconds=1234). Thetotal_*()andin_*()values were computed fordays=1177alone, butin_days()on the same page already showed1997. The page's own note saystotal_seconds()approximates years and months (70848000.0for 2 years 3 months), and70848000.0 + 101700084.001234 == 172548084.001234, which is what the code returns. I updatedtotal_weeks/days/hours/minutes/secondsandin_weeks/hours/minutes/secondsto the real values.in_days()was already right.string_formatting.md
dt.format('dddd Do [of] MMMM YYYY HH:mm:ss A')returns'Thursday 25th of December 1975 14:15:16 PM'. Usinghhgives the documented02:15:16 PM.dt.strftime('%A %-d%t of %B %Y %I:%M:%S %p')returns'Thursday 25\t of December 1975 02:15:16 PM', because%tis a tab and strftime has no ordinal suffix. I changed it to'%A %d of %B %Y %I:%M:%S %p', which returns'Thursday 25 of December 1975 02:15:16 PM'and also works on Windows, where%-disn't supported.to_iso8601_string()for 1975-12-25 14:15:16 in America/New_York returns'1975-12-25T14:15:16-05:00', with a colon in the offset. The docs showed-0500.difference.md,
Date.diff_for_humans()andDateTime.diff_for_humans()docstringsThe English locale formats future values relative to now as
in {}, so the result is'in 1 hour','in 5 months'and'in 1 day', not "... from now".pendulum.now().add(seconds=5).diff_for_humans()returns'in a few seconds', since anything under 10 seconds is "a few seconds". I also changed "remove the modifiersago,from now" toago,in. I checked these withpendulum.travel_to(..., freeze=True)and without freezing too.I left examples alone when their output depends on the current time or the local timezone.