angular / angular/components

bug(material/datepicker): Re-evaluate how the MatDatepicker handles timezones

Open
#11,027 5 comments 8 reactions 0 assignees View on GitHub
area: material/datepicker P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Bug, feature request, or proposal:
Documentation request

#### What is the expected behavior?
The moment object returned by selecting a date with Datepicker should have no timezone information (or UTC)

#### What is the current behavior?
Currently the moment object looks like this: Wed Apr 18 2018 00:00:00 GMT+0300
(The user is located in GMT+3, so his timezone is used)

#### What is the use-case or motivation for changing an existing behavior?
I wonder how to make my matDatepicker return UTC dates so that they are independent of the timezone the user is currently in. I've found lots of issues regarding this (https://github.com/angular/material2/issues/7167), but no clear and simple explanation on how to easily achieve that.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 5.2.0, Angular Material 6.0.0-beta.4, Typescript 2.5.3, ANY browser (not just IE!)

#### Is there anything else we should know?
I'm importing MatMomentDateModule, so all the dates in the app are momentjs dates.

Contributor guide

Open the contributing guide

Research direction

Start with the MatDatepicker and MatMomentDateModule documentation, then review the related issue #7167 for existing timezone discussion. Document a clear, supported way to obtain timezone-independent or UTC dates, including the expected behavior for moment values; the issue is done when users can follow the guidance without relying on scattered issue comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.