[PR #5972] [CLOSED] Added comprehensive edge-case test coverage for DateFormatter #6608

Closed
opened 2026-02-05 10:36:39 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/5972
Author: @InnaTarasyan
Created: 1/3/2026
Status: Closed

Base: developmentHead: test/date-formatter-edge-cases


📝 Commits (1)

  • e3e48e1 Added edge case coverage for DateFormatter

📊 Changes

1 file changed (+610 additions, -0 deletions)

View changed files

📝 tests/Util/DateFormatterTest.php (+610 -0)

📄 Description

This PR expands the existing DateFormatter tests to cover a wider range of real-world edge cases around dates, timezones, and relative formatting.

While the current tests cover the basic behavior, date and timezone handling can be tricky—especially around leap years, DST transitions, and large timezone offsets. These additional tests aim to make that behavior more explicit and guard against subtle regressions in the future.

What’s included

  • Leap year scenarios (Feb 28 / Feb 29 / Mar 1)
  • Daylight Saving Time transitions (spring forward & fall back)
  • Timezones that do and don’t observe DST
  • Conversions across different regions and large offsets
  • Boundary cases (midnight, end of month, end of year)
  • Relative date formatting for past and future dates
  • A check to ensure the formatter doesn’t modify the original Carbon instance

The tests focus on correctness and stability rather than exact string output, to avoid being overly brittle.

Notes

  • No production code changes — tests only
  • Uses multiple timezones to reflect real usage
  • Designed to catch edge cases that are easy to miss during refactors

Why

Date and timezone bugs tend to show up in edge cases rather than normal usage. Adding coverage here should make future changes to DateFormatter safer and easier to reason about.


🔄 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/BookStackApp/BookStack/pull/5972 **Author:** [@InnaTarasyan](https://github.com/InnaTarasyan) **Created:** 1/3/2026 **Status:** ❌ Closed **Base:** `development` ← **Head:** `test/date-formatter-edge-cases` --- ### 📝 Commits (1) - [`e3e48e1`](https://github.com/BookStackApp/BookStack/commit/e3e48e1b2771f2501f25d276b7ad8b3e43109c5e) Added edge case coverage for DateFormatter ### 📊 Changes **1 file changed** (+610 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/Util/DateFormatterTest.php` (+610 -0) </details> ### 📄 Description This PR expands the existing **DateFormatter** tests to cover a wider range of real-world edge cases around dates, timezones, and relative formatting. While the current tests cover the basic behavior, date and timezone handling can be tricky—especially around leap years, DST transitions, and large timezone offsets. These additional tests aim to make that behavior more explicit and guard against subtle regressions in the future. **What’s included** - Leap year scenarios (Feb 28 / Feb 29 / Mar 1) - Daylight Saving Time transitions (spring forward & fall back) - Timezones that do and don’t observe DST - Conversions across different regions and large offsets - Boundary cases (midnight, end of month, end of year) - Relative date formatting for past and future dates - A check to ensure the formatter doesn’t modify the original `Carbon` instance The tests focus on correctness and stability rather than exact string output, to avoid being overly brittle. **Notes** - No production code changes — tests only - Uses multiple timezones to reflect real usage - Designed to catch edge cases that are easy to miss during refactors **Why** Date and timezone bugs tend to show up in edge cases rather than normal usage. Adding coverage here should make future changes to **DateFormatter** safer and easier to reason about. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:36:39 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6608