Skip to content

Commit e7a50d4

Browse files
committed
Fix #576 added logic to ensure AM and PM values are all calculated correctly.
1 parent d2e7e54 commit e7a50d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/controls/dateTimePicker/DateTimePicker.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,17 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
125125
}
126126

127127
if (this.props.timeConvention !== TimeConvention.Hours24) {
128-
if (hoursSplit[1] && hoursSplit[1].toLowerCase().indexOf("am") !== -1) {
128+
if (hoursSplit[1] && hoursSplit[1].toLowerCase().indexOf("pm") !== -1) {
129129
hours += 12;
130130
if (hours === 24) {
131+
//this is noon - set to 12 not 0
132+
//hours = 0;
133+
hours = 12;
134+
}
135+
}
136+
else {
137+
//am - if hours == 12, set hours to 0 here
138+
if (hours == 12){
131139
hours = 0;
132140
}
133141
}

0 commit comments

Comments
 (0)