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 { connect } from 'react-redux';
|
||||||
|
import * as SETTINGS from 'constants/settings';
|
||||||
import { makeSelectPublishFormValue } from 'redux/selectors/publish';
|
import { makeSelectPublishFormValue } from 'redux/selectors/publish';
|
||||||
import { doUpdatePublishForm } from 'redux/actions/publish';
|
import { doUpdatePublishForm } from 'redux/actions/publish';
|
||||||
|
import { selectClientSetting } from 'redux/selectors/settings';
|
||||||
import PublishReleaseDate from './view';
|
import PublishReleaseDate from './view';
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
releaseTime: makeSelectPublishFormValue('releaseTime')(state),
|
releaseTime: makeSelectPublishFormValue('releaseTime')(state),
|
||||||
releaseTimeEdited: makeSelectPublishFormValue('releaseTimeEdited')(state),
|
releaseTimeEdited: makeSelectPublishFormValue('releaseTimeEdited')(state),
|
||||||
releaseTimeError: makeSelectPublishFormValue('releaseTimeError')(state),
|
releaseTimeError: makeSelectPublishFormValue('releaseTimeError')(state),
|
||||||
|
clock24h: selectClientSetting(state, SETTINGS.CLOCK_24H),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
|
|
|
@ -17,18 +17,21 @@ const RESET_TO_ORIGINAL = 'reset-to-original';
|
||||||
const FUTURE_DATE_ERROR = 'Cannot set to a future date.';
|
const FUTURE_DATE_ERROR = 'Cannot set to a future date.';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
releaseTime: ?number,
|
|
||||||
releaseTimeEdited: ?number,
|
|
||||||
updatePublishForm: ({}) => void,
|
|
||||||
allowDefault: ?boolean,
|
allowDefault: ?boolean,
|
||||||
showNowBtn: ?boolean,
|
showNowBtn: ?boolean,
|
||||||
useMaxDate: ?boolean,
|
useMaxDate: ?boolean,
|
||||||
|
// --- redux:
|
||||||
|
releaseTime: ?number,
|
||||||
|
releaseTimeEdited: ?number,
|
||||||
|
clock24h: boolean,
|
||||||
|
updatePublishForm: ({}) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PublishReleaseDate = (props: Props) => {
|
const PublishReleaseDate = (props: Props) => {
|
||||||
const {
|
const {
|
||||||
releaseTime,
|
releaseTime,
|
||||||
releaseTimeEdited,
|
releaseTimeEdited,
|
||||||
|
clock24h,
|
||||||
updatePublishForm,
|
updatePublishForm,
|
||||||
allowDefault = true,
|
allowDefault = true,
|
||||||
showNowBtn = true,
|
showNowBtn = true,
|
||||||
|
@ -155,7 +158,7 @@ const PublishReleaseDate = (props: Props) => {
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
onChange={onDateTimePickerChanged}
|
onChange={onDateTimePickerChanged}
|
||||||
value={date}
|
value={date}
|
||||||
format="y-MM-dd h:mm a"
|
format={clock24h ? 'y-MM-dd HH:mm' : 'y-MM-dd h:mm a'}
|
||||||
disableClock
|
disableClock
|
||||||
clearIcon={null}
|
clearIcon={null}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue