const sanitizationRules = {
created_at: 'date'
}
// or
const sanitizationRules = {
created_at: [
rule('date')
]
}
Converts value to a date. If value is already an instance of Date
, then it
is returned as it is.
Otherwise, the value will be wrapped under new Date()
and instance of it is
returned. In case wrapped date
is invalid, null
will be returned.
const sanitizationRules = {
created_at: 'date'
}
// or
const sanitizationRules = {
created_at: [
rule('date')
]
}
For customized build, you can import this rule as follows.
import { toDate } from 'indicative/builds/validations'