Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module:time-picker): support 12-hour with nzUse12Hours #3127

Merged
merged 21 commits into from
Apr 18, 2019

Conversation

kekehaoz
Copy link
Contributor

@kekehaoz kekehaoz commented Mar 20, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?
TimePicker support 12-hour

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #1513

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

Merging #3127 into master will increase coverage by 0.07%.
The diff coverage is 98.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3127      +/-   ##
==========================================
+ Coverage   97.37%   97.45%   +0.07%     
==========================================
  Files         559      559              
  Lines       11627    11733     +106     
  Branches      835      859      +24     
==========================================
+ Hits        11322    11434     +112     
+ Misses        193      189       -4     
+ Partials      112      110       -2
Impacted Files Coverage Δ
components/time-picker/time-holder.ts 100% <100%> (ø) ⬆️
components/time-picker/nz-time-picker.component.ts 96.87% <100%> (+0.17%) ⬆️
...ents/time-picker/nz-time-picker-panel.component.ts 96.5% <98.07%> (+4.03%) ⬆️
components/badge/nz-badge.component.ts 97.56% <0%> (-2.44%) ⬇️
components/form/nz-form-label.component.ts 100% <0%> (ø) ⬆️
components/steps/nz-steps.component.ts 100% <0%> (ø) ⬆️
components/tree-select/nz-tree-select.component.ts 99.48% <0%> (ø) ⬆️
components/drawer/nz-drawer.component.ts 99.32% <0%> (ø) ⬆️
components/tree/nz-tree.component.ts 98.78% <0%> (+0.01%) ⬆️
components/button/nz-button.component.ts 98.5% <0%> (+0.02%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51c0d53...4fc833e. Read the comment docs.

@netlify
Copy link

netlify bot commented Mar 21, 2019

Deploy preview for ng-zorro-master ready!

Built with commit 4fc833e

https://deploy-preview-3127--ng-zorro-master.netlify.com

@kekehaoz kekehaoz changed the title feat(module: TimePicker): support 12-hour with nzUse12Hours [WIP] feat(module: TimePicker): support 12-hour with nzUse12Hours Mar 21, 2019
add test case in 12-hour feature in TimePicker
@kekehaoz kekehaoz changed the title [WIP] feat(module: TimePicker): support 12-hour with nzUse12Hours [WIP] feat(module: TimePicker): support 12-hour with nzUse12Hours(#1513) Mar 21, 2019
add unit test case on '12-hour' featrue
@hsuanxyz hsuanxyz changed the title [WIP] feat(module: TimePicker): support 12-hour with nzUse12Hours(#1513) [WIP] feat(module: time-picker): support 12-hour with nzUse12Hours Mar 22, 2019
@TheAifam5
Copy link

Would not be better to handle it like “nzConvention=‘12’” and “nzConvention=‘24’”?

@kekehaoz
Copy link
Contributor Author

Would not be better to handle it like “nzConvention=‘12’” and “nzConvention=‘24’”?

To keep same with Ant Design of React

@kekehaoz kekehaoz changed the title [WIP] feat(module: time-picker): support 12-hour with nzUse12Hours feat(module:time-picker): support 12-hour with nzUse12Hours Apr 1, 2019
@@ -201,6 +209,21 @@ export class NzTimePickerPanelComponent implements ControlValueAccessor, OnInit,
return this._nzSecondStep;
}

@Input()
set nzUse12Hours(value: boolean) {
Copy link
Member

Choose a reason for hiding this comment

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

这里尽量不要使用getter/setter的方式,改用ngOnChanges中作变化检测吧

@@ -49,6 +49,7 @@ export class NzTimePickerPanelComponent implements ControlValueAccessor, OnInit,
private _defaultOpenValue = new Date();
private _opened = false;
private _allowEmpty = true;
private _nzUse12Hours = false;
Copy link
Member

Choose a reason for hiding this comment

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

替换掉getter/setter方式后,应该只需要使用 nzUse12Hours 变量即可

Replace getter/setter with ngOnChanges to implement nzUse12Hours
@kekehaoz kekehaoz force-pushed the feat/timePicker-support-12-hour branch from 1a2f2fe to 913d314 Compare April 11, 2019 09:02
@kekehaoz kekehaoz requested a review from wilsoncook April 16, 2019 09:06
@wilsoncook wilsoncook merged commit 7c52774 into NG-ZORRO:master Apr 18, 2019
@patricknazar
Copy link

Thank you @wilsoncook !

@wilsoncook
Copy link
Member

All thanks to @kekehaoz

@patricknazar
Copy link

My mistake, thanks @kekehaoz !!

andrew-yangy pushed a commit to andrew-yangy/ng-zorro-antd that referenced this pull request Jun 20, 2019
Ricbet pushed a commit to Ricbet/ng-zorro-antd that referenced this pull request Apr 9, 2020
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this pull request Aug 5, 2020
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.

4 participants