Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix(dataclasses): include milliseconds in scalar types
  • Loading branch information
Michael Brewer committed Jul 2, 2021
commit b08802ef33647bfa6222d96a4838e3d57fd9b80c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def aws_time(timezone_offset: int = 0) -> str:
str
Returns current time as AWSTime scalar string with optional timezone offset
"""
return _formatted_time(datetime.datetime.utcnow(), "%H:%M:%S", timezone_offset)
return _formatted_time(datetime.datetime.utcnow(), "%H:%M:%S.%f", timezone_offset)


def aws_datetime(timezone_offset: int = 0) -> str:
Expand All @@ -81,7 +81,7 @@ def aws_datetime(timezone_offset: int = 0) -> str:
str
Returns current time as AWSDateTime scalar string with optional timezone offset
"""
return _formatted_time(datetime.datetime.utcnow(), "%Y-%m-%dT%H:%M:%S", timezone_offset)
return _formatted_time(datetime.datetime.utcnow(), "%Y-%m-%dT%H:%M:%S.%f", timezone_offset)


def aws_timestamp() -> int:
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_data_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,13 +1210,13 @@ def test_aws_date_utc():
def test_aws_time_utc():
time_str = aws_time()
assert isinstance(time_str, str)
assert datetime.datetime.strptime(time_str, "%H:%M:%SZ")
assert datetime.datetime.strptime(time_str, "%H:%M:%S.%fZ")


def test_aws_datetime_utc():
datetime_str = aws_datetime()
assert isinstance(datetime_str, str)
assert datetime.datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%SZ")
assert datetime.datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%S.%fZ")


def test_aws_timestamp():
Expand Down