'use strict'; var pluginRecordHook = require('@flatfile/plugin-record-hook'); var n = require('chrono-node'); var dateFns = require('date-fns'); var locale = require('date-fns/locale'); function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n.default = e; return Object.freeze(n); } var n__namespace = /*#__PURE__*/_interopNamespace(n); function l(e,t){try{let o=n__namespace.parseDate(e);if(o){let r=dateFns.format(o,t.outputFormat,{locale:locale.enUS});return t.includeTime?r:r.split(" ")[0]}return null}catch(o){return console.error(o),null}}function u(e){return pluginRecordHook.recordHook(e.sheetSlug||"**",(t,o)=>(e.dateFields.forEach(r=>{let a=t.get(r);if(a){let i=l(a,e);i?t.set(r,i):t.addError(r,"Unable to parse date string");}}),t))} exports.validateDate = u; //# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map