# Conflicts: # src/components/common/Pager.module.css # src/lib/constants.ts # src/lib/yup.ts # src/pages/api/teams/[id]/users/index.ts # src/pages/api/websites/[id]/reports.ts
16 lines
359 B
TypeScript
16 lines
359 B
TypeScript
import moment from 'moment';
|
|
import * as yup from 'yup';
|
|
import { UNIT_TYPES } from './constants';
|
|
|
|
export const TimezoneTest = yup.string().test(
|
|
'timezone',
|
|
() => `Invalid timezone`,
|
|
value => moment.tz.zone(value) !== null,
|
|
);
|
|
|
|
export const UnitTypeTest = yup.string().test(
|
|
'unit',
|
|
() => `Invalid unit`,
|
|
value => UNIT_TYPES.includes(value),
|
|
);
|