Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ConceptJunkie/rpn
Browse files Browse the repository at this point in the history
  • Loading branch information
ConceptJunkie committed Mar 16, 2024
2 parents fa6b496 + 483a2e6 commit 4a2c066
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rpn/time/rpnDateTimeClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import pendulum

from rpn.util.rpnDebug import debugPrint
from rpn.units.rpnMeasurementClass import RPNMeasurement
from rpn.special.rpnLocationLookup import lookUpLocation, lookUpTimeZone

Expand Down Expand Up @@ -201,14 +202,14 @@ def add( self, time ):
if not isinstance( time, RPNMeasurement ):
ValueError( 'RPNMeasurement expected' )

#print( 'time.getUnitName( )', time.getUnitName( ) )
#print( 'g.unitOperators[ time.getUnitName( ) ].categories', g.unitOperators[ time.getUnitName( ) ].categories )
debugPrint( 'time.getUnitName( )', time.getUnitName( ) )
debugPrint( 'g.unitOperators[ time.getUnitName( ) ].categories', g.unitOperators[ time.getUnitName( ) ].categories )

if 'years' in g.unitOperators[ time.getUnitName( ) ].categories:
if time.getUnitName( ) == 'year':
years = time.value
result = self.dateTime.add( years=int( years ) )
return RPNDateTime.convertFromPendulum( result, dateOnly=self.dateOnly )
elif 'months' in g.unitOperators[ time.getUnitName( ) ].categories:
elif time.getUnitName( ) == 'month':
months = time.value
result = self.dateTime.add( months=int( months ) )
return RPNDateTime.convertFromPendulum( result, dateOnly=self.dateOnly )
Expand Down

0 comments on commit 4a2c066

Please sign in to comment.