feat : ajout de la clôture de contrat et de la création de contrat

This commit is contained in:
2026-03-03 11:59:41 +01:00
parent 0b01e7772c
commit fc2b184c50
12 changed files with 712 additions and 121 deletions

View File

@@ -0,0 +1,17 @@
export const CONTRACT_NATURES = ['CDI', 'CDD', 'INTERIM'] as const
export type ContractNature = (typeof CONTRACT_NATURES)[number]
export const contractNatureLabel = (value?: ContractNature) => {
if (value === 'CDD') return 'CDD'
if (value === 'INTERIM') return 'Intérim'
return 'CDI'
}
export const requiresContractEndDate = (nature: ContractNature) => {
return nature === 'CDD' || nature === 'INTERIM'
}
export const isContractNature = (value: string): value is ContractNature => {
return (CONTRACT_NATURES as readonly string[]).includes(value)
}

View File

@@ -6,6 +6,17 @@ export const toYmd = (year: number, month: number, day: number) => {
export const normalizeDate = (value: string) => value.slice(0, 10)
export const formatYmdToFr = (value: string) => {
const [year, month, day] = value.split('-')
if (!year || !month || !day) return value
return `${day}/${month}/${year}`
}
export const formatNullableYmdToFr = (value?: string | null, fallback = 'En cours') => {
if (!value) return fallback
return formatYmdToFr(value)
}
export const parseYmd = (value: string) => {
const [year, month, day] = value.split('-').map(Number)
if (!year || !month || !day) return null