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

[TimePicker] Update display of 12h clock (Fixes #1173) #1200

Closed
wants to merge 6 commits into from

Conversation

joewalker
Copy link

No description provided.


// Treat midday/midnight specially http://www.nist.gov/pml/div688/times.cfm
if (hours === "12" && mins === "00" && additional === " am") {
return "12 midday";
Copy link
Member

Choose a reason for hiding this comment

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

Should this be 12 noon? Also, I think it would be a good idea to add a prop to switch this feature on and off.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed and agreed. Will update PR.

@hai-cea
Copy link
Member

hai-cea commented Jul 20, 2015

Hi @joewalker - Thanks for this PR. I just a small question and suggestion.

@@ -32,6 +33,7 @@ let TimePicker = React.createClass({
return {
defaultTime: emptyTime,
format: 'ampm',
pedantic: true,
Copy link
Member

Choose a reason for hiding this comment

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

Thanks @joewalker - I think we should default this to false since setting it to true is somewhat of a breaking change. Everything else looks good.

name: 'pedantic',
type: 'boolean',
header: 'default: true',
desc: 'It\'s technically more correct to refer to "12 noon" and "12 midnight" rather than "12 a.m." and "12 p.m." and it avoids real confusion between different locales. The default is to use the unambiguous forms (noon/midnight) but if you prefer the system of using "a.m./p.m." set pedantic={false}.'
Copy link
Member

Choose a reason for hiding this comment

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

The header and description needs to match the new default value of false.

if (hours === "12" && mins === "00" && additional === " pm") {
return "12 midnight";
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This logic is reversed - 12am is midnight and 12pm is noon correct?

Also can be simplified:

if (this.props.pedantic && hours === '12' && mins === '00') {
  return additional === ' am' ? '12 midnight' : '12 noon';
}

@hai-cea
Copy link
Member

hai-cea commented Jul 27, 2015

@joewalker Everything looks good - Please squash down to 1 commit and I'll merge. Thanks again!

@joewalker joewalker closed this Aug 3, 2015
@zannager zannager added component: time picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! labels Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! component: time picker This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants