mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
20 lines
488 B
TypeScript
20 lines
488 B
TypeScript
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
import type { FormKitNode } from '@formkit/core'
|
|
|
|
export default {
|
|
ruleType: 'date_range',
|
|
rule: (node: FormKitNode<string[]>) => {
|
|
const { value } = node
|
|
|
|
const startDate = value.at(0)
|
|
const endDate = value.at(1)
|
|
|
|
if (!startDate || !endDate) return false
|
|
|
|
return startDate <= endDate
|
|
},
|
|
localeMessage: () => {
|
|
return __('The start date must precede or match end date.')
|
|
},
|
|
}
|