@@ -206,7 +206,7 @@ As expected the date, time and timezone values are all copied to the new instanc
206206.. code-block :: python
207207
208208 dt = pendulum.now()
209- print (dt.diff(dt.copy().add_year( )).in_years())
209+ print (dt.diff(dt.copy().add( years = 1 )).in_years())
210210 1
211211
212212 # dt was unchanged and still holds the value of pendulum.now()
@@ -251,7 +251,7 @@ by using the class method ``pendulum.set_locale()``.
251251 import pendulum
252252
253253 pendulum.set_locale(' de' )
254- print (pendulum.now().add_year( ).diff_for_humans())
254+ print (pendulum.now().add( years = 1 ).diff_for_humans())
255255 ' in 1 Jahr'
256256
257257 pendulum.set_locale(' en' )
@@ -262,7 +262,7 @@ method accept a ``locale`` keyword argument to use a locale for a specific call.
262262.. code-block :: python
263263
264264 pendulum.set_locale(' de' )
265- print (pendulum.now().add_year( ).diff_for_humans(locale = ' fr' ))
265+ print (pendulum.now().add( years = 1 ).diff_for_humans(locale = ' fr' ))
266266 ' dans 1 an'
267267
268268
@@ -619,7 +619,7 @@ the ``now()`` is created in the same timezone as the instance.
619619 born = pendulum.from_date(1987 , 4 , 23 )
620620 not_birthday = pendulum.from_date(2014 , 9 , 26 )
621621 birthday = pendulum.from_date(2014 , 2 , 23 )
622- past_birthday = pendulum.now().sub_years( 50 )
622+ past_birthday = pendulum.now().sub( years = 50 )
623623
624624 born.is_birthday(not_birthday)
625625 False
@@ -633,8 +633,8 @@ the ``now()`` is created in the same timezone as the instance.
633633 Addition and Subtraction
634634========================
635635
636- To easily adding and subtracting time, you can use the ``add_xxx () ``/`` sub_xxx () ``
637- methods or the more generic ones `` add() ``/`` sub() ` `.
636+ To easily adding and subtracting time, you can use the ``add () `` and `` sub () ``
637+ methods`.
638638Each method returns a new ``Pendulum `` instance.
639639
640640.. code-block :: python
@@ -646,67 +646,67 @@ Each method returns a new ``Pendulum`` instance.
646646 dt.to_datetime_string()
647647 ' 2012-01-31 00:00:00'
648648
649- dt = dt.add_years( 5 )
649+ dt = dt.add( years = 5 )
650650 ' 2017-01-31 00:00:00'
651- dt = dt.add_year( )
651+ dt = dt.add( years = 1 )
652652 ' 2018-01-31 00:00:00'
653- dt = dt.sub_year( )
653+ dt = dt.sub( years = 1 )
654654 ' 2017-01-31 00:00:00'
655- dt = dt.sub_years( 5 )
655+ dt = dt.sub( years = 5 )
656656 ' 2012-01-31 00:00:00'
657657
658- dt = dt.add_months( 60 )
658+ dt = dt.add( months = 60 )
659659 ' 2017-01-31 00:00:00'
660- dt = dt.add_month( )
660+ dt = dt.add( months = 1 )
661661 ' 2017-02-28 00:00:00'
662- dt = dt.sub_month( )
662+ dt = dt.sub( months = 1 )
663663 ' 2017-01-28 00:00:00'
664- dt = dt.sub_months( 60 )
664+ dt = dt.sub( months = 60 )
665665 ' 2012-01-28 00:00:00'
666666
667- dt = dt.add_days( 29 )
667+ dt = dt.add( days = 29 )
668668 ' 2012-02-26 00:00:00'
669- dt = dt.add_day( )
669+ dt = dt.add( days = 1 )
670670 ' 2012-02-27 00:00:00'
671- dt = dt.sub_day( )
671+ dt = dt.sub( days = 1 )
672672 ' 2012-02-26 00:00:00'
673- dt = dt.sub_days( 29 )
673+ dt = dt.sub( days = 29 )
674674 ' 2012-01-28 00:00:00'
675675
676- dt = dt.add_weeks( 3 )
676+ dt = dt.add( weeks = 3 )
677677 ' 2012-02-18 00:00:00'
678- dt = dt.add_week( )
678+ dt = dt.add( weeks = 1 )
679679 ' 2012-02-25 00:00:00'
680- dt = dt.sub_week( )
680+ dt = dt.sub( weeks = 1 )
681681 ' 2012-02-18 00:00:00'
682- dt = dt.sub_weeks( 3 )
682+ dt = dt.sub( weeks = 3 )
683683 ' 2012-01-28 00:00:00'
684684
685- dt = dt.add_hours( 24 )
685+ dt = dt.add( hours = 24 )
686686 ' 2012-01-29 00:00:00'
687- dt = dt.add_hour( )
687+ dt = dt.add( hours = 1 )
688688 ' 2012-02-25 01:00:00'
689- dt = dt.sub_hour( )
689+ dt = dt.sub( hours = 1 )
690690 ' 2012-02-29 00:00:00'
691- dt = dt.sub_hours( 24 )
691+ dt = dt.sub( hours = 24 )
692692 ' 2012-01-28 00:00:00'
693693
694- dt = dt.add_minutes( 61 )
694+ dt = dt.add( minutes = 61 )
695695 ' 2012-01-28 01:01:00'
696- dt = dt.add_minute( )
696+ dt = dt.add( minutes = 1 )
697697 ' 2012-01-28 01:02:00'
698- dt = dt.sub_minute( )
698+ dt = dt.sub( minutes = 1 )
699699 ' 2012-01-28 01:01:00'
700- dt = dt.sub_minutes( 24 )
700+ dt = dt.sub( minutes = 24 )
701701 ' 2012-01-28 00:00:00'
702702
703- dt = dt.add_seconds( 61 )
703+ dt = dt.add( seconds = 61 )
704704 ' 2012-01-28 00:01:01'
705- dt = dt.add_second( )
705+ dt = dt.add( seconds = 1 )
706706 ' 2012-01-28 00:01:02'
707- dt = dt.sub_second( )
707+ dt = dt.sub( seconds = 1 )
708708 ' 2012-01-28 00:01:01'
709- dt = dt.sub_seconds( 61 )
709+ dt = dt.sub( seconds = 61 )
710710 ' 2012-01-28 00:00:00'
711711
712712 dt = dt.add(years = 3 , months = 2 , days = 6 , hours = 12 , minutes = 31 , seconds = 43 )
@@ -751,28 +751,28 @@ This will default to ``True``, return the absolute value. The comparisons are do
751751 - 3
752752
753753 dt = pendulum.create(2012 , 1 , 31 , 0 )
754- dt.diff(dt.add_month( )).in_days()
754+ dt.diff(dt.add( months = 1 )).in_days()
755755 29
756- dt.diff(dt.sub_month( ), False ).in_days()
756+ dt.diff(dt.sub( months = 1 ), False ).in_days()
757757 - 31
758758
759759 dt = pendulum.create(2012 , 4 , 30 , 0 )
760- dt.diff(dt.add_month( )).in_days()
760+ dt.diff(dt.add( months = 1 )).in_days()
761761 30
762- dt.diff(dt.add_week( )).in_days()
762+ dt.diff(dt.add( weeks = 1 )).in_days()
763763 7
764764
765765 dt = pendulum.create(2012 , 1 , 1 , 0 )
766- dt.diff(dt.add_seconds( 59 )).in_minutes()
766+ dt.diff(dt.add( seconds = 59 )).in_minutes()
767767 0
768- dt.diff(dt.add_seconds( 60 )).in_minutes()
768+ dt.diff(dt.add( seconds = 60 )).in_minutes()
769769 1
770- dt.diff(dt.add_seconds( 119 )).in_minutes()
770+ dt.diff(dt.add( seconds = 119 )).in_minutes()
771771 1
772- dt.diff(dt.add_seconds( 120 )).in_minutes()
772+ dt.diff(dt.add( seconds = 120 )).in_minutes()
773773 2
774774
775- dt.add_seconds( 120 ).seconds_since_midnight()
775+ dt.add( seconds = 120 ).seconds_since_midnight()
776776 120
777777
778778 Difference for Humans
@@ -806,25 +806,25 @@ You may also pass ``True`` as a 2nd parameter to remove the modifiers `ago`, `fr
806806 # The most typical usage is for comments
807807 # The instance is the date the comment was created
808808 # and its being compared to default now()
809- pendulum.now().sub_days( ).diff_for_humans()
809+ pendulum.now().sub( dayss = 1 ).diff_for_humans()
810810 ' 5 days ago'
811811
812- pendulum.now().diff_for_humans(Pendulum.now().sub_year( ))
812+ pendulum.now().diff_for_humans(Pendulum.now().sub( years = 1 ))
813813 ' 1 year after'
814814
815815 dt = pendulum.from_date(2011 , 8 , 1 )
816- dt.diff_for_humans(dt.add_month( ))
816+ dt.diff_for_humans(dt.add( months = 1 ))
817817 ' 1 month before'
818- dt.diff_for_humans(dt.sub_month( ))
818+ dt.diff_for_humans(dt.sub( months = 1 ))
819819 ' 1 month after'
820820
821- pendulum.now().add_seconds( 5 ).diff_for_humans()
821+ pendulum.now().add( seconds = 5 ).diff_for_humans()
822822 ' 5 seconds from now'
823823
824- pendulum.now().sub_days( 24 ).diff_for_humans()
824+ pendulum.now().sub( days = 24 ).diff_for_humans()
825825 ' 3 weeks ago'
826826
827- pendulum.now().sub_days( 24 ).diff_for_humans(absolute = True )
827+ pendulum.now().sub( days = 24 ).diff_for_humans(absolute = True )
828828 ' 3 weeks'
829829
830830 You can also change the locale of the string either globally by using ``pendulum.set_locale('fr') ``
@@ -836,9 +836,9 @@ argument. See the `Localization`_ section for more detail.
836836 import pendulum
837837
838838 pendulum.set_locale(' de' )
839- pendulum.now().add_year( ).diff_for_humans()
839+ pendulum.now().add( years = 1 ).diff_for_humans()
840840 ' in 1 Jahr'
841- pendulum.now().add_year( ).diff_for_humans(locale = ' fr' )
841+ pendulum.now().add( years = 1 ).diff_for_humans(locale = ' fr' )
842842 ' dans 1 an'
843843
844844
0 commit comments