angular / angular/components

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

未关闭
#11,027 5 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看
area: material/datepicker P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

#### 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.

贡献指南

打开贡献指南

调研方向

先从 MatDatepicker 和 MatMomentDateModule 文档开始,然后查看相关 issue #7167,了解现有的时区讨论。记录一种清晰且受支持的方式来获取与时区无关的日期或 UTC 日期,包括 moment 值的预期行为;当用户无需依赖 issue 中零散的评论即可遵循指南时,该 issue 即告完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
documentation, frontend
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。