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

Fix am / pm i18n's bug #22963

Merged
merged 5 commits into from
Jun 20, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions packages/components/src/date-time/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ class TimePicker extends Component {
? date
.clone()
.hours(
am === 'AM' ? value % 12 : ( ( value % 12 ) + 12 ) % 24
am === __( 'AM' )
? value % 12
: ( ( value % 12 ) + 12 ) % 24
)
: date.clone().hours( value );
this.changeDate( newDate );
Expand Down Expand Up @@ -184,7 +186,7 @@ class TimePicker extends Component {
return;
}
let newDate;
if ( value === 'PM' ) {
if ( value === __( 'PM' ) ) {
torounit marked this conversation as resolved.
Show resolved Hide resolved
newDate = date
.clone()
.hours( ( ( parseInt( hours, 10 ) % 12 ) + 12 ) % 24 );
Expand Down Expand Up @@ -336,17 +338,17 @@ class TimePicker extends Component {
{ is12Hour && (
<ButtonGroup className="components-datetime__time-field components-datetime__time-field-am-pm">
<Button
isPrimary={ am === 'AM' }
isSecondary={ am !== 'AM' }
onClick={ this.updateAmPm( 'AM' ) }
isPrimary={ am === __( 'AM' ) }
isSecondary={ am !== __( 'AM' ) }
onClick={ this.updateAmPm( __( 'AM' ) ) }
className="components-datetime__time-am-button"
>
{ __( 'AM' ) }
</Button>
<Button
isPrimary={ am === 'PM' }
isSecondary={ am !== 'PM' }
onClick={ this.updateAmPm( 'PM' ) }
isPrimary={ am === __( 'PM' ) }
isSecondary={ am !== __( 'PM' ) }
onClick={ this.updateAmPm( __( 'PM' ) ) }
className="components-datetime__time-pm-button"
>
{ __( 'PM' ) }
Expand Down