felixakiragreen / react-kronos

A fast, intuitive, and elegant date and time picker for React.
https://felixakiragreen.github.io/react-kronos/
MIT License
90 stars 28 forks source link

Incorrect time format when using timeStep #57

Closed chipit24 closed 7 years ago

chipit24 commented 7 years ago

I have my component set up like so:

<Kronos
  time={this.state.selectedTime}
  format={'h:mm a'}
  onChangeDateTime={this.handleTime.bind(this)}
  placeholder="Time" />

Which results in the format of the time in the dropdown to be shown correctly:

screen shot 2017-04-19 at 2 23 02 pm

However, when I add timeStep, the time in the dropdown is now formatted in 24-hour time:

screen shot 2017-04-19 at 2 33 24 pm

The issue seems to be with this: https://github.com/dubert/react-kronos/blob/master/src/calendar.js#L244. The README mentions:

hour: - string : default: h:mm a

But looking at the source, it seems that minute is used, and the default is HH:mm, and not h:mm a.

To get things working how I want, I had to set:

options={{
  format: {minute: 'h:mm a'}
}}
schuchowsky commented 7 years ago

Had the same issue here.

felixakiragreen commented 7 years ago

Just released 1.6.0!

This issue should be addressed, let me know if it is not.