-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Conversation
|
||
// Treat midday/midnight specially http://www.nist.gov/pml/div688/times.cfm | ||
if (hours === "12" && mins === "00" && additional === " am") { | ||
return "12 midday"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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, |
There was a problem hiding this comment.
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}.' |
There was a problem hiding this comment.
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"; | ||
} | ||
} |
There was a problem hiding this comment.
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';
}
@joewalker Everything looks good - Please squash down to 1 commit and I'll merge. Thanks again! |
No description provided.