Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

datepicker: with UTC timezone set doesn't handle time offset +2:00 #12028

Closed
@nicklastromb

Description

@nicklastromb

Bug

Demo and steps to reproduce the issue

  1. Demo page with user interaction
  2. Demo page during load

Detailed Reproduction Steps (With user interaction)

  1. Create a controller with a md-datepicker in the template
  2. Set the ng-model-options to {timezone:'UTC'}
  3. Load the view and open the datepicker. The date will be incorrectly displayed in the datepicker and the date will have an updated time offset.
  4. The time for the date is now 00:00 (but with correct timezone) instead of the correct timezone adjustment

See demo url (1)

Detailed Reproduction Steps (Without interaction)

This step is a bit harder to reproduce as it seems to depend on what is loaded in the view. I've been able to reproduce this in the example for timezone settings at https://material.angularjs.org/latest/demo/datepicker, I've copied the demo to codepen where it seems to appear as long as the calendar is loaded together with the datepicker. I've also experienced this issue without any calendar being loaded in the view.

  1. Create a view with a calendar and a datepicker component
  2. Set the ng-model-options to {timezone:'UTC'}
  3. Load the view, the datepicker timestamp should now be "00:00" instead of the correct offset

Any selection of a date will update the time offset properly.
Removing the calendar will prevent the problem from occurring.

See demo url (2)

Explain the expected behavior

Time for the date should not be affected when opening or loading the datepicker.

Explain the current behavior

When setting an initial date the time part of the date will be affected when either opening up the datepicker and closing it or during the initial load of the datepicker in some scenarios. This is not expected bahavior.

Discuss the use-case or motivation for changing the existing behavior

The current behavior is unexpected and may lead to an invalid date being selected when using the datepicker component.

List the affected versions of AngularJS, Material, OS, and browsers

  • AngularJS: 1.8.1, 1.8.0
  • AngularJS Material: 1.2.1, 1.1.26
  • OS: Windows 10
  • Browsers: Chrome 85.0.4183.12

Add anything else we should know

Screenshots

When opening the datepicker
2020-10-06-184523-RiI1B7KOub

During first load

2020-10-06-182557-chrome_jFJj1KV2jd

After a date is selected after first load the time offset is updated correctly

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions