-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
DatePicker 12 hour am/pm format? #1578
Comments
* remove moment.js * up HISTORY.md * use constant var * upgrade rmc-picker * add test, remove unused code * fix setMonth * add use12Hours support * fix use12Hours, ref ant-design/ant-design-mobile#1578 * improve HISTORY
Doesn't appear to be working for me.
Still showing 24 hour time |
@SpringsTea are you using React Native? It only works on web. https://mobile.ant.design/components/date-picker/ |
Ah I see. For anyone else who gets stuck here, after digging through some doc I found something that mentioned that setting showTime to an object will be passed to the TimePicker, so you can make it work like this:
|
I was able to get the 12 hour working using this but I can't get rid of the seconds...
Anyone have a solution? |
@developdeez - this worked to format the time without seconds. Basically pass the format option to showTime as well:
|
An alternative is to interface directly with moment object spit out by datepicker. Use the format method.
|
* remove moment.js * up HISTORY.md * use constant var * upgrade rmc-picker * add test, remove unused code * fix setMonth * add use12Hours support * fix use12Hours, ref ant-design/ant-design-mobile#1578 * improve HISTORY
* remove moment.js * up HISTORY.md * use constant var * upgrade rmc-picker * add test, remove unused code * fix setMonth * add use12Hours support * fix use12Hours, ref ant-design/ant-design-mobile#1578 * improve HISTORY
This one works but if I select time for PM it goes beyond 12h as |
Use hh instead of HH |
* remove moment.js * up HISTORY.md * use constant var * upgrade rmc-picker * add test, remove unused code * fix setMonth * add use12Hours support * fix use12Hours, ref ant-design/ant-design-mobile#1578 * improve HISTORY
Hi, my friend, you don't need to use |
What problem does this feature solve?
Common to use 12 hour am/pm format in the US, rather than military time.
What does the proposed API look like?
Either allow to pass in hh to the format, or have a prop (like antd web) 12hour={true}
The text was updated successfully, but these errors were encountered: