node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
import { translatedErrors } from '@strapi/admin/strapi-admin';
import { zonedTimeToUtc } from 'date-fns-tz';
import * as yup from 'yup';
/**
* FormikErrors type enforce us to always return a string as error.
* We need these errors to be translated, so we need to create a hook to be able to use the formatMessage function.
*/ const RELEASE_SCHEMA = yup.object().shape({
name: yup.string().trim().required(translatedErrors.required.id).nullable(),
scheduledAt: yup.string().nullable(),
isScheduled: yup.boolean().optional(),
time: yup.string().when('isScheduled', {
is: true,
then: yup.string().trim().required(translatedErrors.required.id),
otherwise: yup.string().nullable()
}).test('time-in-future-if-today', 'content-releases.modal.form.time.has-passed', function(time) {
const { date, timezone } = this.parent;
if (!date || !timezone || !time) {
return true;
}
// Timezone is in format "UTC&Europe/Paris", so we get the region part for the dates functions
const region = timezone.split('&')[1];
const selectedTime = zonedTimeToUtc(`${date} ${time}`, region);
const now = new Date();
return selectedTime > now;
}),
timezone: yup.string().when('isScheduled', {
is: true,
then: yup.string().required(translatedErrors.required.id).nullable(),
otherwise: yup.string().nullable()
}),
date: yup.string().when('isScheduled', {
is: true,
then: yup.string().required(translatedErrors.required.id).nullable(),
otherwise: yup.string().nullable()
})
}).required().noUnknown();
const SETTINGS_SCHEMA = yup.object().shape({
defaultTimezone: yup.string().nullable().default(null)
}).required().noUnknown();
export { RELEASE_SCHEMA, SETTINGS_SCHEMA };
//# sourceMappingURL=schemas.mjs.map