Skip to content

Commit eeac35f

Browse files
committed
v1.4.5 update
1 parent b1b145d commit eeac35f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

datemath/helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
class DateMathException(BaseException):
4747
pass
4848

49-
5049
def unitMap(c):
5150
'''
5251
maps our units ( 'd', 'y', 'M', etc ) to shorthands required for arrow
@@ -66,8 +65,10 @@ def unitMap(c):
6665
return 'hours'
6766
elif c == 's' or c == 'S' or c.lower() == 'seconds' or c.lower() == 'second':
6867
return 'seconds'
68+
elif c.lower() == 'n' or c.lower() == 'now':
69+
raise DateMathException("""Timeunit: "{0}" is not valid. If you are trying to specify 'now' after timestamp (i.e. 2016-01-01||now/d) that is not valid. Please try 2016-01-01||/d instead""".format(c))
6970
else:
70-
raise DateMathException("Not a valid offset: {0}".format(c))
71+
raise DateMathException("Not a valid timeunit: {0}".format(c))
7172

7273
def as_datetime(expression, now, tz='UTC'):
7374
'''

0 commit comments

Comments
 (0)