Skip to content

Commit 0e32103

Browse files
committed
Fix documentation example of fluent helpers
The REPL output now matches the instructions. Extra info has been added to aid with the explanation as well for those who are not aware of DST.
1 parent 3382956 commit 0e32103

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/docs/fluent_helpers.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,24 @@ converts the time in the appropriate timezone.
4545
```python
4646
>>> import pendulum
4747

48-
>>> dt = pendulum.datetime(2013, 3, 31, 2, 30)
49-
>>> print(dt)
48+
>>> dt0 = pendulum.datetime(2013, 3, 31, 2, 30)
49+
>>> print(dt0)
5050
'2013-03-31T02:30:00+00:00'
5151

52-
>>> dt = dt.set(tz='Europe/Paris')
52+
>>> # Paris started DST on that exact day, so 2h30 local time doesn't exist. It immediately rolls over to 3h30.
53+
>>> dt = dt0.set(tz='Europe/Paris')
5354
>>> print(dt)
5455
'2013-03-31T03:30:00+02:00'
5556

56-
>>> dt = dt.in_tz('Europe/Paris')
57+
>>> dt = dt0.in_tz('Europe/Paris')
5758
>>> print(dt)
5859
'2013-03-31T04:30:00+02:00'
5960

60-
>>> dt = dt.set(tz='Europe/Paris').set(tz='UTC')
61+
>>> dt = dt0.set(tz='Europe/Paris').set(tz='UTC')
6162
>>> print(dt)
6263
'2013-03-31T03:30:00+00:00'
6364

64-
>>> dt = dt.in_tz('Europe/Paris').in_tz('UTC')
65+
>>> dt = dt0.in_tz('Europe/Paris').in_tz('UTC')
6566
>>> print(dt)
6667
'2013-03-31T02:30:00+00:00'
6768
```

0 commit comments

Comments
 (0)