Reputation: 169
How to change the time to the format when the day is 23 o'clock. For example, when I click on 23 in the datapicker, 11 is shown, but i want to see 23
function onChange(date, dateString) {
console.log(date, dateString);
}
ReactDOM.render(
<Space direction="vertical">
<DatePicker
allowClear
placeholder="укажите дату"
local="ISO 8601"
showTime={{
defaultValue: moment("00:00:00", "HH:mm:ss")
}}
format="YYYY-MM-DD hh:mm:ss"
onChange={onChange}
/>
</Space>,
document.getElementById("container")
);
Upvotes: 1
Views: 1527
Reputation: 1215
Lowercase, i.e. 'h' or 'hh' is used for 12 hour format in momentjs.
Now since you want a 24 hour format, use 'H' or 'HH'. Use format="YYYY-MM-DD HH:mm:ss"
. This should work.
Upvotes: 3