Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cxotime/cxotime.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ def __new__(cls, *args, **kwargs):
# Stub in a value for `val` so super()__new__ can run since `val`
# is a required positional arg.
args = (None, )
else:
elif 'val' not in kwargs:
raise ValueError('cannot supply keyword arguments with no time value')

return super().__new__(cls, *args, **kwargs)

def __init__(self, *args, **kwargs):
Expand All @@ -276,8 +277,11 @@ def __init__(self, *args, **kwargs):
if kwargs.setdefault('format', 'date') != 'date':
raise ValueError("must use format 'date' for DateTime input")
else:
# For `CxoTime()`` return the current time in `date` format.
args = (Time.now().yday, )
if 'val' in kwargs:
args = (kwargs.pop('val'), )
else:
# For `CxoTime()`` return the current time in `date` format.
args = (Time.now().yday, )

# If format is supplied and is a DateTime format then require scale='utc'.
fmt = kwargs.get('format')
Expand Down