Skip to content

fix(data-classes): include milliseconds in scalar types #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 6, 2021
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
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