Skip to content

fix: replaced Date with java.time API (#397)#398

Merged
petruki merged 1 commit into
master-2from
staging
Jun 27, 2026
Merged

fix: replaced Date with java.time API (#397)#398
petruki merged 1 commit into
master-2from
staging

Conversation

@petruki

@petruki petruki commented Jun 27, 2026

Copy link
Copy Markdown
Member

This pull request modernizes date and time handling throughout the codebase by replacing legacy Date and DateUtils usage with Java 8+ time APIs (Instant, LocalDateTime, DateTimeFormatter, etc.). The changes improve code readability, reliability, and future-proof the code by leveraging the more robust and thread-safe Java time library. The updates also include corresponding changes in tests and utility methods.

The most important changes are:

Migration to Java Time API:

  • Replaced all uses of Date, SimpleDateFormat, and DateUtils with Instant, LocalDateTime, and DateTimeFormatter in both production code and tests for date and time manipulation and parsing. [1] [2] [3] [4] [5] [6]

Core Utility and Service Updates:

  • Refactored SwitcherUtils.addTimeDuration to use Instant and ChronoUnit instead of Date and DateUtils, and updated all its usages accordingly. [1] [2] [3]

Validator Refactoring:

  • Updated DateValidator and TimeValidator to use LocalDateTime and DateTimeFormatter, including parsing, comparisons, and exception handling. This affects how date and time operations (e.g., LOWER, GREATER, BETWEEN) are implemented. [1] [2]

Test Suite Adjustments:

  • Refactored all affected tests to use the new Java time APIs, including updating test data setup, assertions, and helper methods in SwitcherUtilsTest and MockWebServerHelper. [1] [2] [3]

Dependency Cleanup:

  • Removed unnecessary imports for DateUtils, SimpleDateFormat, and related legacy date/time classes from all affected files. [1] [2] [3] [4] [5] [6] [7]

@petruki petruki added this to the v2.6.0 milestone Jun 27, 2026
@petruki petruki self-assigned this Jun 27, 2026
@petruki petruki added enhancement New feature or request ai-assisted Indicates that AI tools were used to assist this with this change labels Jun 27, 2026
@sonarqubecloud

Copy link
Copy Markdown

@petruki petruki merged commit c66b6b8 into master-2 Jun 27, 2026
9 checks passed
@petruki petruki deleted the staging branch June 27, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Indicates that AI tools were used to assist this with this change enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant