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

Time picker: add hour/minute only mode #4939

Merged
merged 17 commits into from
Jun 7, 2019
Merged

Conversation

SAndreeva
Copy link
Contributor

Closes #4679

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code
  • This PR includes API docs for newly added methods/properties
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes
  • This PR includes behavioral changes and the feature specification has been updated with them

@SAndreeva SAndreeva added 🛠️ status: in-development Issues and PRs with active development on them and removed ❌ status: awaiting-test PRs awaiting manual verification labels May 31, 2019
@SAndreeva SAndreeva added ❌ status: awaiting-test PRs awaiting manual verification and removed 🛠️ status: in-development Issues and PRs with active development on them labels Jun 3, 2019
@sboykova sboykova added 💥 status: in-test PRs currently being tested and removed ❌ status: awaiting-test PRs awaiting manual verification labels Jun 4, 2019
@sboykova
Copy link
Contributor

sboykova commented Jun 4, 2019

Please, @SAndreeva add this change to the changelog.md

let formattedMinute;
let formattedHour;
let amPM;
const amPM = (hour > 11) ? 'PM' : 'AM';
Copy link
Contributor

Choose a reason for hiding this comment

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

Better replace am/pm with enum values

}
}

if (listName.indexOf('minuteList') !== -1 && this.timePicker.ampmList) {
this.timePicker.ampmList.nativeElement.focus();
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate code with the line above (ampmList.nativeElement.focus()) - merge if possible

if (this.timePicker.minuteList) {
this.timePicker.minuteList.nativeElement.focus();
} else if (this.timePicker.hourList) {
this.timePicker.hourList.nativeElement.focus();
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate code with the line above (...hourList.nativeElement.focus()) - merge if possible

date.setSeconds(0);
if (this.selectedAmPm === 'PM' && this.selectedHour !== '12') {
if (this.showHoursList && this.selectedAmPm === 'PM' && this.selectedHour !== '12') {
Copy link
Contributor

Choose a reason for hiding this comment

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

merge conditions with the below line if possible to avoid duplicating code (date.setHours(date.getHours() + 12))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather not, this logic is very fragile.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could merge those with || and the result will be the same.

date.setHours(date.getHours() + 12);
}

if (!this.showHoursList && amPM === 'PM' && date.getHours().toString() <= '11') {
Copy link
Contributor

Choose a reason for hiding this comment

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

merge with the above condition to avoid duplicating code (date.setHours(date.getHours() + 12))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather not, this logic is very fragile.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could merge those with || and the result will be the same.

date.setSeconds(0);
if (this.selectedAmPm === 'PM' && this.selectedHour !== '12') {
if (this.showHoursList && this.selectedAmPm === 'PM' && this.selectedHour !== '12') {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could merge those with || and the result will be the same.

@sboykova sboykova added ✅ status: verified Applies to PRs that have passed manual verification and removed 💥 status: in-test PRs currently being tested labels Jun 7, 2019
@bkulov bkulov merged commit 9018e5a into 7.3.x Jun 7, 2019
@bkulov bkulov deleted the SAndreeva/time-picker-hour-mode branch June 7, 2019 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕐 time-picker version: 7.3.x ✅ status: verified Applies to PRs that have passed manual verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants