Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/docs/attributes_properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Pendulum gives access to more attributes and properties than the default ``datet
>>> dt.microsecond
123789
>>> dt.day_of_week
3
<WeekDay.WEDNESDAY: 2>
>>> dt.day_of_year
248
249
>>> dt.week_of_month
1
>>> dt.week_of_year
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/difference.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ to the instance and the passed in instance. There are 4 possibilities:
* 5 months ago

* When comparing a value in the future to default now:
* 1 hour from now
* 5 months from now
* in 1 hour
* in 5 months

* When comparing a value in the past to another value:
* 1 hour before
Expand All @@ -70,7 +70,7 @@ to the instance and the passed in instance. There are 4 possibilities:
* 1 hour after
* 5 months after

You may also pass `True` as a 2nd parameter to remove the modifiers `ago`, `from now`, etc.
You may also pass `True` as a 2nd parameter to remove the modifiers `ago`, `in`, etc.

```python
>>> import pendulum
Expand All @@ -91,7 +91,7 @@ You may also pass `True` as a 2nd parameter to remove the modifiers `ago`, `from
'1 month after'

>>> pendulum.now().add(seconds=5).diff_for_humans()
'5 seconds from now'
'in a few seconds'

>>> pendulum.now().subtract(days=24).diff_for_humans()
'3 weeks ago'
Expand Down
18 changes: 9 additions & 9 deletions docs/docs/duration.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,39 +123,39 @@ you can use the appropriate methods.
# Each method returns a float like the native
# total_seconds() method
>>> it.total_weeks()
168.15490079569113
285.2977579385483

>>> it.total_days()
1177.0843055698379
1997.0843055698379

>>> it.total_hours()
28250.02333367611
47930.02333367611

>>> it.total_minutes()
1695001.4000205665
2875801.400020567

>>> it.total_seconds()
101700084.001234
172548084.001234
```

Similarly, the `in_xxx()` methods return the total duration in each
supported unit as a truncated integer.

```python
>>> it.in_weeks()
168
285

>>> it.in_days()
1997

>>> it.in_hours()
28250
47930

>>> it.in_minutes()
1695001
2875801

>>> it.in_seconds()
101700084
172548084
```

It also has a handy `in_words()` method, which determines the duration representation when printed.
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/string_formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ The default string representation is the same as the one returned by the `isofor
'Thu, Dec 25, 1975 2:15 PM'

# You can also use the format() method
>>> dt.format('dddd Do [of] MMMM YYYY HH:mm:ss A')
>>> dt.format('dddd Do [of] MMMM YYYY hh:mm:ss A')
'Thursday 25th of December 1975 02:15:16 PM'

# Of course, the strftime method is still available
>>> dt.strftime('%A %-d%t of %B %Y %I:%M:%S %p')
'Thursday 25th of December 1975 02:15:16 PM'
>>> dt.strftime('%A %d of %B %Y %I:%M:%S %p')
'Thursday 25 of December 1975 02:15:16 PM'
```

!!!note
Expand All @@ -57,7 +57,7 @@ The following are methods to display a `DateTime` instance as a common format:
'Thursday, 25-Dec-1975 14:15:16 EST'

>>> dt.to_iso8601_string()
'1975-12-25T14:15:16-0500'
'1975-12-25T14:15:16-05:00'

>>> dt.to_rfc822_string()
'Thu, 25 Dec 75 14:15:16 -0500'
Expand Down
4 changes: 2 additions & 2 deletions src/pendulum/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ def diff_for_humans(
5 months ago

When comparing a value in the future to default now:
1 day from now
5 months from now
in 1 day
in 5 months

When comparing a value in the past to another value:
1 day before
Expand Down
4 changes: 2 additions & 2 deletions src/pendulum/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,8 @@ def diff_for_humans( # type: ignore[override]
5 months ago

When comparing a value in the future to default now:
1 day from now
5 months from now
in 1 day
in 5 months

When comparing a value in the past to another value:
1 day before
Expand Down