PublishDate: make widget follow the 24h format setting (#1776)

Closes 1738
This commit is contained in:
infinite-persistence 2022-06-29 20:34:32 +08:00 committed by GitHub
parent 70ea3f0812
commit 4569a4f9f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -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) => ({

View file

@ -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}
/>