From 4909af2c270e3ef374f8a6b69f68cce90af6e0f4 Mon Sep 17 00:00:00 2001 From: Petr Jasek Date: Fri, 15 Nov 2024 19:59:35 +0100 Subject: [PATCH] save --- .../UI/Form/DateTimeInput/index.tsx | 1 + .../UI/Form/TimeInput/TimeInputPopup.tsx | 77 ++++++++++++------- client/components/UI/Form/TimeInput/index.tsx | 6 +- .../components/fields/editor/EndDateTime.tsx | 1 + .../fields/editor/EventSchedule.tsx | 45 ++++++----- .../fields/editor/StartDateTime.tsx | 1 + .../fields/editor/base/dateTime.tsx | 5 +- client/validators/events.ts | 21 ++--- client/validators/index.ts | 4 +- 9 files changed, 98 insertions(+), 63 deletions(-) diff --git a/client/components/UI/Form/DateTimeInput/index.tsx b/client/components/UI/Form/DateTimeInput/index.tsx index 48243929a..df0d94970 100644 --- a/client/components/UI/Form/DateTimeInput/index.tsx +++ b/client/components/UI/Form/DateTimeInput/index.tsx @@ -102,6 +102,7 @@ export const DateTimeInput = ({ showToBeConfirmed={showToBeConfirmed} onToBeConfirmed={onToBeConfirmed} toBeConfirmed={toBeConfirmed} + required={false} /> )} {canClear && ( diff --git a/client/components/UI/Form/TimeInput/TimeInputPopup.tsx b/client/components/UI/Form/TimeInput/TimeInputPopup.tsx index a8b52bd0b..48ad2ea2c 100644 --- a/client/components/UI/Form/TimeInput/TimeInputPopup.tsx +++ b/client/components/UI/Form/TimeInput/TimeInputPopup.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import moment from 'moment'; import {range} from 'lodash'; @@ -10,12 +9,34 @@ import {Button} from '../../'; import './style.scss'; +interface IProps { + value: any; + onChange(value: string): void; + close(): void; + target: string; + popupContainer(): void; + onPopupOpen(): void; + onPopupClose(): void; + showToBeConfirmed: boolean; + onToBeConfirmed(): void; + toBeConfirmedText: string; +} + +interface IState { + currentTime: moment.Moment; + selectedHourIndex: number; + selectedMinuteIndex: number; +} + /** * @ngdoc react * @name TimeInputPopup * @description Main Popup Component of TimePicker */ -export class TimeInputPopup extends React.Component { +export class TimeInputPopup extends React.Component { + hours = range(0, 24); + minutes = range(0, 60, 5); + constructor(props) { super(props); this.state = { @@ -23,9 +44,6 @@ export class TimeInputPopup extends React.Component { selectedMinuteIndex: 0, currentTime: moment(), }; - - this.hours = range(0, 24); - this.minutes = range(0, 60, 5); } componentWillMount() { @@ -64,7 +82,7 @@ export class TimeInputPopup extends React.Component { const {onChange, close} = this.props; if (addMinutes) { - let newTime = moment.clone(this.state.currentTime); + let newTime = moment(this.state.currentTime); newTime.add(addMinutes, 'm'); onChange(newTime.format('HH:mm')); @@ -77,6 +95,13 @@ export class TimeInputPopup extends React.Component { close(); } + handleClear() { + const {onChange, close} = this.props; + + onChange(null); + close(); + } + render() { return (
- {!this.props.showToBeConfirmed && ( + {!this.props.showToBeConfirmed ? (
- )} - {this.props.showToBeConfirmed && ( + ) : (