Automatically parse and standardize date values during data import, converting various date formats into a consistent output format.
string
(optional)'**'
(all sheets)string[]
(required)string
(required)date-fns
format patterns (e.g., ‘MM/dd/yyyy’, ‘yyyy-MM-dd HH:mm:ss’).boolean
(required)false
, any time information from the parsed date will be stripped, leaving only the date part. If true
, the time will be included as formatted by outputFormat
.string
(optional)'en-US'
(hardcoded)due_date: 'not a real date'
, the plugin will not change the value but will attach an error message.
sheetSlug
and dateFields
in the configuration correctly match your workbook setup.outputFormat
string is a valid format recognized by date-fns
.chrono-node
or it may conflict with the hardcoded ‘en-US’ locale (e.g., a DD/MM/YYYY format might be misinterpreted as MM/DD/YYYY).commit:created
event. For each committed record, it checks the fields specified in dateFields
. If a value exists, it attempts to parse it as a date. If successful, it reformats the date according to outputFormat
and updates the record. If parsing fails, it adds an error message to the cell and leaves the original value unchanged. By default, it operates on all sheets unless a specific sheetSlug
is provided.
chrono-node
library for date parsing, which supports a wide variety of natural language and standard date formats.commit:created
event, meaning it runs after a user submits their data and before it is finalized.outputFormat
string must be compatible with the date-fns
formatting library.locale
configuration option is not currently implemented. The plugin defaults to using the ‘en-US’ locale for parsing, regardless of the value passed in the configuration. This may affect parsing of formats where the day and month order are ambiguous (e.g., ‘01/02/2023’).chrono-node
cannot parse the date string from a given field, the function returns null
. The plugin then calls record.addError(field, 'Unable to parse date string')
to flag the cell with an error message in the Flatfile UI. The original, un-parsable value is kept in the cell.