Skip to content

bug(LuxonDateAdapter): Zone set on DateTime ignored #26869

@cusher

Description

@cusher

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

14.x

Description

As part of the update to Luxon 3 for the LuxonDateAdapter, a change was made so that setZone(undefined) is called whenever useUtc is not enabled on the options. This means that now there are now only two possibilities when using the adapter:

  1. Use UTC via the adapter options
  2. Use the default zone from Luxon

Previously, if useUtc was not set, the adapter would keep the timezone that had been set on the Luxon DateTime object.

This is either an undocumented breaking change (with no clean way to get the previous behavior) or a regression.

Reproduction

Steps to reproduce:

  1. Create a Luxon DateTime with a zone different from the default zone, where it falls on a different day than it would when shifted into the default zone.
  2. Set the DateTime as the value for a form control using the LuxonDateAdapter.

Expected Behavior

The form control shows the date as set on the date time object.

Actual Behavior

The form control shows the date shifted into the default time zone.

Environment

  • Angular: 15.2.5
  • CDK/Material: 15.2.5
  • Browser(s): Firefox 111.0, Chrome 111.0
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions