Skip to content

Conversation

@yplarthur
Copy link
Contributor

@yplarthur yplarthur commented Nov 4, 2025

PR Checklist

This PR fulfills the following requirements:

  • The commit message follows our guidelines: Contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A changelog entry was added

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When selecting a date via the Datepicker component from a different timezone (e.g. Tokyo or Los Angeles), the display value of the input field, the actual value, and the "selected" (graphically) value in the calendar do not match.

Issue Number: N/A

What is the new behavior?

When selecting a date via the Datepicker component from any timezone, it will select and display the correct value.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Updated the date-fns package to the latest version and uses the @date-fns/tz from this new version.
The current version of TypeScript for the angular components is not entirely compatible with this new version of the package, due to its use of the "export type *" syntax, .cts extensions and Intl types. Added skipLibCheck to tsconfig because of this, but for the future we should try to update the components so that they are compatible with newer versions of TypeScript.

Resolved issues

https://jira.antwerpen.be/browse/GFOP-162


it('should update the model if the value is a valid date', () => {
const date = new Date();
const date = new Date('2018-01-10T00:00:00Z');
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would new Date() not suffice? Or in other words, is this implementation going to be a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done in order to have the same result every time the test ran. Changing this back to new Date() would not cause the test to fail. However, in regards to the breaking change: actually, yes, it is a breaking change, I will adjust the PR description.
Users of the component will now always get back the Brussels timezone value. So if there are applications that were doing their own calculations in order to get the correct value for their specific timezone, those will need to check their implementations of the calendar and datepicker components.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, clear. In this case, I would not label it as a breaking change (in semantic versioning), unless the previous behaviour is fixed first in this major release. Agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that it should be kept as a bug/fix, but I would add a clear explanation in the release notes and recommend users to thoroughly test their date calculations after upgrading

@TriangleJuice TriangleJuice merged commit 1695b36 into master Nov 12, 2025
1 check passed
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.

5 participants