Closed anvk closed 7 years ago
You're right. I should do that.
But for your case just do...
<Kronos time={this.state.time} format={'H:mm'} />
Amazing thanks a lot !
Sorry about that, but I just got my hands on the example and tried both:
<Kronos time={new Date()} format={'HH:mm'} />
and
<Kronos time={new Date()} format={'H:mm'} />
Both of those options will generate am/pm dropdown menu
Both formats @anvk gets am/pm in the dropdown for give me 24 hour. I also tried hh:mm, hh:mm a, setting my moment locale to 'en' before creating moment objects, and more.
@dubert Is there any solution to this? I'm using 1.5.3.
Thanks very much for any advice you can give me.
@anvk @Slapbox
To format the input box use: format={'H:mm'}
To format the dropdown use: options={ { format: { hour: 'H:mm' } } }
Please let me know if those don't work. I just tested them myself and they appear to behave correctly.
For me this is what worked (passed into options
on the Kronos
component):
let kronosOptions = {
format: {
minute: 'hh:mm a'
},
moment: moment.localeData('en-us')
};
Should I have had to pass this into minutes? Passing it into hours had some effect, but it was buggy/not the desired behavior.
Hey @dubert, I didn't see your last response.
options={ { format: { hour: 'hh:mm a' } } }
does not work on the dropdown list
options={ { format: { minute: 'hh:mm a' } } }
does work on the dropdown list
Just released 1.6.0!
This issue should be fixed. Using options={ { format: { hour: 'hh:mm a' } }
is working correctly for me.
First of all thanks a lot for this great component.
It would be so amazing if you would expand on your example page showing different possible options and features of your component with some code examples. Per say I'm struggling right now to make Kronos to show only time and then to show a dropdown with 24hr format time instead of am/pm one and not sure how to do that.