feat: support fetching monitor status from different dates #472
+77
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've enhanced the /api/status endpoint to support time range queries. Here's what was changed:
Current behavior was: Uptime calculated from start of current day to now (or specified timestamp).
Enhanced functionality:
- start_date: Start date in YYYY-MM-DD format
- end_date: End date in YYYY-MM-DD format
- GET /api/status?tag=your-monitor&start_date=2025-07-01&end_date=2025-07-31 - July uptime
- GET /api/status?tag=your-monitor&start_date=2025-07-01 - From July 1st to now
- GET /api/status?tag=your-monitor&end_date=2025-07-31 - July 31st (full day)
- GET /api/status?tag=your-monitor - Current day (existing behavior)
- time_range.start: Start timestamp
- time_range.end: End timestamp
- Original fields: status, uptime, last_updated_at
- Invalid date formats
- Start date after end date
- No data for time range
The uptime calculation now works across any specified date range, giving you exactly what you requested - the ability to query uptime between
specific dates like July 1-31.