Skip to content

Commit

Permalink
fix: Block end date#309 (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
amabelleS authored Mar 1, 2024
1 parent 6b5e27b commit 70dee7d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/components/DateSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { DataAndTimeSelectorProps } from './utils/dateAndTime'
import { DateValidationError } from '@mui/x-date-pickers'

export function DateSelector({ time, onChange, customLabel }: DataAndTimeSelectorProps) {
export function DateSelector({ time, onChange, customLabel, minDate }: DataAndTimeSelectorProps) {
const [error, setError] = useState<DateValidationError | null>(null)
const { t } = useTranslation()

Expand All @@ -31,6 +31,7 @@ export function DateSelector({ time, onChange, customLabel }: DataAndTimeSelecto
format="DD/MM/YYYY"
label={customLabel || t('choose_date')}
disableFuture
minDate={minDate}
onError={(err) => setError(err)}
slotProps={{
textField: {
Expand Down
1 change: 1 addition & 0 deletions src/pages/components/utils/dateAndTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export type DataAndTimeSelectorProps = {
time: moment.Moment
onChange: (timeValid: moment.Moment) => void
customLabel?: string
minDate?: moment.Moment
}
1 change: 1 addition & 0 deletions src/pages/dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const DashboardPage = () => {
<DateSelector
time={endDate}
onChange={(data) => setEndDate(data)}
minDate={startDate}
customLabel={t('end')}
/>
</Grid>
Expand Down
1 change: 1 addition & 0 deletions src/pages/gapsPatterns/GapsPatternsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const GapsPatternsPage = () => {
<DateSelector
time={endDate}
onChange={(data) => setEndDate(data)}
minDate={startDate}
customLabel={t('end')}
/>
</Grid>
Expand Down

0 comments on commit 70dee7d

Please sign in to comment.