PublishDate: make widget follow the 24h format setting (#1776)
Closes 1738
This commit is contained in:
parent
70ea3f0812
commit
4569a4f9f8
2 changed files with 10 additions and 4 deletions
|
@ -1,12 +1,15 @@
|
|||
import { connect } from 'react-redux';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectPublishFormValue } from 'redux/selectors/publish';
|
||||
import { doUpdatePublishForm } from 'redux/actions/publish';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import PublishReleaseDate from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
releaseTime: makeSelectPublishFormValue('releaseTime')(state),
|
||||
releaseTimeEdited: makeSelectPublishFormValue('releaseTimeEdited')(state),
|
||||
releaseTimeError: makeSelectPublishFormValue('releaseTimeError')(state),
|
||||
clock24h: selectClientSetting(state, SETTINGS.CLOCK_24H),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
|
|
@ -17,18 +17,21 @@ const RESET_TO_ORIGINAL = 'reset-to-original';
|
|||
const FUTURE_DATE_ERROR = 'Cannot set to a future date.';
|
||||
|
||||
type Props = {
|
||||
releaseTime: ?number,
|
||||
releaseTimeEdited: ?number,
|
||||
updatePublishForm: ({}) => void,
|
||||
allowDefault: ?boolean,
|
||||
showNowBtn: ?boolean,
|
||||
useMaxDate: ?boolean,
|
||||
// --- redux:
|
||||
releaseTime: ?number,
|
||||
releaseTimeEdited: ?number,
|
||||
clock24h: boolean,
|
||||
updatePublishForm: ({}) => void,
|
||||
};
|
||||
|
||||
const PublishReleaseDate = (props: Props) => {
|
||||
const {
|
||||
releaseTime,
|
||||
releaseTimeEdited,
|
||||
clock24h,
|
||||
updatePublishForm,
|
||||
allowDefault = true,
|
||||
showNowBtn = true,
|
||||
|
@ -155,7 +158,7 @@ const PublishReleaseDate = (props: Props) => {
|
|||
onBlur={handleBlur}
|
||||
onChange={onDateTimePickerChanged}
|
||||
value={date}
|
||||
format="y-MM-dd h:mm a"
|
||||
format={clock24h ? 'y-MM-dd HH:mm' : 'y-MM-dd h:mm a'}
|
||||
disableClock
|
||||
clearIcon={null}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue