[PR #125] [MERGED] Return consistent date formats in API #897

Closed
opened 2026-02-25 23:44:03 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/healthchecks/healthchecks/pull/125
Author: @prgTW
Created: 6/28/2017
Status: Merged
Merged: 6/29/2017
Merged by: @cuu508

Base: masterHead: patch-1


📝 Commits (1)

  • 27f917c Return consistent date formats in API

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 hc/api/models.py (+2 -2)

📄 Description

datetime.isoformat returns different date formats whether microseconds part equals 0 or not.

datetime.isoformat([sep])
Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm or, if microsecond is 0, YYYY-MM-DDTHH:MM:SS

ref: https://docs.python.org/2/library/datetime.html#datetime.datetime.isoformat

datetime.isoformat function is used in the API and thus producing inconsistency in the API.
Tests assume the microseconds equals 0 so let's skip microseconds part from the API as well


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/healthchecks/healthchecks/pull/125 **Author:** [@prgTW](https://github.com/prgTW) **Created:** 6/28/2017 **Status:** ✅ Merged **Merged:** 6/29/2017 **Merged by:** [@cuu508](https://github.com/cuu508) **Base:** `master` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`27f917c`](https://github.com/healthchecks/healthchecks/commit/27f917ce02dae9e77e0853dd12590a69b46d220a) Return consistent date formats in API ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `hc/api/models.py` (+2 -2) </details> ### 📄 Description `datetime.isoformat` returns different date formats whether microseconds part equals 0 or not. > __datetime.isoformat([sep])__ > Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm or, if microsecond is 0, YYYY-MM-DDTHH:MM:SS ref: https://docs.python.org/2/library/datetime.html#datetime.datetime.isoformat `datetime.isoformat` function is used in the API and thus producing inconsistency in the API. [Tests assume the microseconds equals 0](https://github.com/healthchecks/healthchecks/blob/20b046cba717790aa1f55de4a60a83eedafa57ce/hc/api/tests/test_list_checks.py#L15) so let's skip microseconds part from the API as well --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 23:44:03 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#897
No description provided.