Skip to content

Conversation

@BastienClement
Copy link
Contributor

Fixes #121

Copilot AI review requested due to automatic review settings September 29, 2025 17:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates the Duration format for negative values to align with ISO 8601-2:2019 standard by moving the negative sign to the beginning of the entire duration string rather than applying it to individual components.

  • Changes negative duration format from PT-1M-2S to -PT1M2S
  • Updates the toISOString() method to handle negative sign placement correctly
  • Updates all corresponding test cases to match the new format

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Duration.php Modifies the toISOString() method to place negative sign at the beginning of the duration string
tests/DurationTest.php Updates test data provider to match the new negative duration format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Negative durations now format as '-PT2H21M' instead of 'PT-2H-21M'
- Improves compatibility with JavaScript Temporal API
@BastienClement BastienClement force-pushed the negative-duration-format branch from f582b18 to f316a73 Compare September 29, 2025 17:44
@BenMorel BenMorel merged commit bc17ae0 into brick:master Nov 10, 2025
7 checks passed
@BenMorel
Copy link
Member

Excellent, thank you @BastienClement! And sorry for the review delay.

@BenMorel
Copy link
Member

Released as 0.8.0.

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.

Consider formatting negative Duration using a prefixed single '-' sign

2 participants