(val: string)
| 24 | |
| 25 | // parses a function from the given format to default datetime format |
| 26 | export const parse = (val: string) => { |
| 27 | // allow the date to be empty |
| 28 | if (!val) return val; |
| 29 | const date = new Date(val); |
| 30 | if (!isNaN(date.getTime())) { |
| 31 | return new Date(val).toISOString(); |
| 32 | } |
| 33 | return val; |
| 34 | }; |
| 35 | |
| 36 | function parseDateFormat(format: string | boolean | undefined): string { |
| 37 | if (typeof format === 'string') { |
no outgoing calls
no test coverage detected