mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
More yup validations.
This commit is contained in:
parent
2ccb8d0a3c
commit
ce2a83a09f
12 changed files with 99 additions and 50 deletions
|
|
@ -1,11 +1,10 @@
|
|||
import moment from 'moment';
|
||||
import * as yup from 'yup';
|
||||
|
||||
export function getDateRangeValidation() {
|
||||
return {
|
||||
startAt: yup.number().integer().required(),
|
||||
endAt: yup.number().integer().moreThan(yup.ref('startAt')).required(),
|
||||
};
|
||||
}
|
||||
export const DateRangeValidation = {
|
||||
startAt: yup.number().integer().required(),
|
||||
endAt: yup.number().integer().moreThan(yup.ref('startAt')).required(),
|
||||
};
|
||||
|
||||
// ex: /funnel|insights|retention/i
|
||||
export function getFilterValidation(matchRegex) {
|
||||
|
|
@ -17,3 +16,9 @@ export function getFilterValidation(matchRegex) {
|
|||
orderBy: yup.string(),
|
||||
};
|
||||
}
|
||||
|
||||
export const TimezoneTest = yup.string().test(
|
||||
'timezone',
|
||||
() => `Invalid timezone`,
|
||||
value => !moment.tz.zone(value),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue