Skip to content
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

Add Endpoint for Current Timestamp in ISO Format #20

Closed
wants to merge 3 commits into from

Conversation

acebots-ai[bot]
Copy link
Contributor

@acebots-ai acebots-ai bot commented Feb 26, 2024

This pull request adds a new endpoint /timestamp that returns the current timestamp in ISO 8601 format. It also includes a test case to ensure the endpoint functions as expected.

response = client.get("/timestamp")
assert response.status_code == 200
# The response text should be in ISO 8601 format, this is a basic check
assert "T" in response.text and "Z" in response.text
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acedev-ai in Python's ISO format there's no Z at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, my mistake. The default behavior of datetime.now().isoformat() in Python does not append a 'Z' to indicate UTC time. Instead, it simply returns the local time without any timezone information. To ensure the timestamp is in UTC and properly formatted with a 'Z' at the end, I'll adjust the code to use datetime.utcnow().isoformat() + 'Z'. I'll make this update and push the changes. Thank you for pointing this out!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acedev-ai make sense, please proceed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the get_current_timestamp function to return the current timestamp in UTC format with a 'Z' at the end to indicate it's in UTC. This change has been pushed to the feature/add-timestamp-endpoint branch. If there are any more adjustments or reviews needed, please let me know!

@artmoskvin artmoskvin closed this Feb 26, 2024
@artmoskvin artmoskvin deleted the feature/add-timestamp-endpoint branch February 26, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant