Skip to content

Commit 8e93017

Browse files
committed
Updates README
1 parent 488c588 commit 8e93017

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

README.rst

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,39 @@ and it will try its best to return something while silently failing to handle so
6060
.. code-block:: python
6161
6262
arrow.get('2016-1-17')
63-
#<Arrow [2016-01-01T00:00:00+00:00]>
63+
# <Arrow [2016-01-01T00:00:00+00:00]>
6464
6565
pendulum.parse('2016-1-17')
66-
#<Pendulum [2016-01-17T00:00:00+00:00]>
66+
# <Pendulum [2016-01-17T00:00:00+00:00]>
6767
6868
# Parsing of a date with wrong day
6969
arrow.get('2015-06-31')
70-
#<Arrow [2015-06-01T00:00:00+00:00]>
70+
# <Arrow [2015-06-01T00:00:00+00:00]>
7171
7272
pendulum.parse('2016-06-31')
7373
# ValueError: day is out of range for month
7474
7575
# fromtimestamp with timezone displays wrong offset
7676
arrow.Arrow.fromtimestamp(0, pytz.timezone('Europe/Paris'))
77-
#<Arrow [1970-01-01T01:00:00+00:09]>
77+
# <Arrow [1970-01-01T01:00:00+00:09]>
7878
7979
pendulum.from_timestamp(0, pytz.timezone('Europe/Paris'))
8080
# fromtimestamp() is also possible
81-
#<Pendulum [1970-01-01T01:00:00+01:00]>
81+
# <Pendulum [1970-01-01T01:00:00+01:00]>
82+
83+
# Working with DST
84+
just_before = arrow.Arrow(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
85+
just_after = just_before.replace(microseconds=1)
86+
87+
(just_after.to('utc') - just_before.to('utc')).total_seconds()
88+
-3599.999999
89+
# Should be 1e-06
90+
91+
just_before = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
92+
just_after = just_before.add(microseconds=1)
93+
94+
(just_after.in_timezone('utc') - just_before.in_timezone('utc')).total_seconds()
95+
1e-06
8296
8397
Those are a few examples showing that Arrow cannot always be trusted to have a consistent
8498
behavior with the data you are passing to it.

0 commit comments

Comments
 (0)