@de100/form-echo
Version:
A form state management for fields validations and errors
1 lines • 21 kB
Source Map (JSON)
{"version":3,"sources":["../src/utils/helpers/inputDate.js","../src/utils/helpers/fieldValue.js"],"sourcesContent":["/**\r\n * Formats a date object to the desired string format based on the type.\r\n * @param {Date} date - The Date object to be formatted.\r\n * @param {import(\"../..\").InputDateTypes} type - The format type ('date', 'time', 'datetime-local', 'week', or 'month').\r\n * @returns {string} A formatted string based on the specified format.\r\n */\r\nexport function formatDate(date, type) {\r\n\t// Initialize an empty string to hold the formatted date\r\n\tlet formattedDate = '';\r\n\r\n\t// Use a switch statement to determine the appropriate formatting based on the `type` argument\r\n\tswitch (type) {\r\n\t\tcase 'date':\r\n\t\t\t// For the 'date' type, format the date as yyyy-mm-dd using toISOString and slice\r\n\t\t\tformattedDate = date.toISOString().slice(0, 10);\r\n\t\t\tbreak;\r\n\t\tcase 'time':\r\n\t\t\t// For the 'time' type, format the time as hh:mm:ss using toTimeString and slice\r\n\t\t\tformattedDate = date.toTimeString().slice(0, 8);\r\n\t\t\tbreak;\r\n\t\tcase 'datetime-local':\r\n\t\t\t// For the 'datetime-local' type, format the date and time as yyyy-mm-ddThh:mm:ss using toISOString, slice, and replace\r\n\t\t\t// formattedDate = date.toISOString().slice(0, 16);\r\n\t\t\t// formattedDate = formattedDate.replace('T', ' ');\r\n\t\t\tformattedDate = `${date.getFullYear()}-${`${\r\n\t\t\t\tdate.getMonth() + 1\r\n\t\t\t}`.padStart(2, '0')}-${`${date.getDate()}`.padStart(\r\n\t\t\t\t2,\r\n\t\t\t\t'0',\r\n\t\t\t)}T${`${date.getHours()}`.padStart(\r\n\t\t\t\t2,\r\n\t\t\t\t'0',\r\n\t\t\t)}:${`${date.getMinutes()}`.padStart(2, '0')}`;\r\n\t\t\tbreak;\r\n\t\tcase 'week':\r\n\t\t\t// For the 'week' type, format the week as yyyy-Www using getWeekNumber and padStart\r\n\t\t\tconst year = date.getFullYear();\r\n\t\t\tconst weekNumber = getWeekNumber(date);\r\n\t\t\tformattedDate = `${year}-W${\r\n\t\t\t\tweekNumber.toString().length < 2\r\n\t\t\t\t\t? '0' + weekNumber.toString()\r\n\t\t\t\t\t: weekNumber.toString()\r\n\t\t\t}`;\r\n\t\t\t// weekNumber.toString().padStart(2, '0')\r\n\t\t\tbreak;\r\n\t\tcase 'month':\r\n\t\t\t// For the 'month' type, format the month as yyyy-mm using toISOString and slice\r\n\t\t\tformattedDate = date.toISOString().slice(0, 7);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// If the type is not recognized, return an empty string\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t// Return the formatted date\r\n\treturn formattedDate;\r\n}\r\n\r\n/**\r\n * Parses a string in the specified format and returns a Date object.\r\n * @param {string | number} dateString - The string to be parsed.\r\n * @param {string} type - The format type ('date', 'time', 'datetime-local', 'week', or 'month').\r\n * @returns {Date} - The parsed Date object.\r\n */\r\nexport function parseDate(dateString, type) {\r\n\t// Declare a variable to hold the parsed date\r\n\t/** @type {Date} */\r\n\tlet parsedDate;\r\n\r\n\t// Use a switch statement to handle the various date/time formats\r\n\tswitch (type) {\r\n\t\tcase 'date':\r\n\t\t\t// For the 'date' type, parse the string as a date in ISO format (yyyy-mm-dd)\r\n\t\t\tparsedDate = new Date(dateString);\r\n\t\t\tbreak;\r\n\t\tcase 'time':\r\n\t\t\t// For the 'time' type, split the string into hours, minutes, and seconds components\r\n\t\t\tconst [hours, minutes, seconds] = dateString.toString().split(':');\r\n\t\t\t// Create a new Date object and set the hours, minutes, and seconds based on the input string\r\n\t\t\tparsedDate = new Date();\r\n\t\t\tparsedDate.setHours(Number(hours || 0));\r\n\t\t\tparsedDate.setMinutes(Number(minutes || 0));\r\n\t\t\tparsedDate.setSeconds(Number(seconds || 0));\r\n\t\t\tbreak;\r\n\t\tcase 'datetime-local':\r\n\t\t\t// For the 'datetime-local' type, replace the space character with 'T' and parse the resulting string as a date in ISO format\r\n\t\t\tparsedDate = new Date(dateString.toString().replace(' ', 'T'));\r\n\t\t\tbreak;\r\n\t\tcase 'week':\r\n\t\t\t// For the 'week' type, split the string into year and week number components\r\n\t\t\tconst [yearString, weekString] = dateString.toString().split('-W');\r\n\t\t\tconst year = Number(yearString);\r\n\t\t\tconst week = Number(weekString);\r\n\t\t\t// Use the getFirstDateOfWeek helper function to calculate the first date of the specified week in the specified year\r\n\t\t\tparsedDate = getFirstDateOfWeek(year, week);\r\n\t\t\tbreak;\r\n\t\tcase 'month':\r\n\t\t\t// For the 'month' type, append '-01' to the input string to represent the first day of the month and parse as a date in ISO format\r\n\t\t\tparsedDate = new Date(`${dateString}-01`);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// For an unrecognized format, return the current date/time\r\n\t\t\tparsedDate = new Date();\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t// Return the parsed Date object\r\n\treturn parsedDate;\r\n}\r\n\r\n/**\r\n * Returns the week number of the year for a given date.\r\n * @param {Date} date - The date object for which to calculate the week number.\r\n * @returns {number} - The week number.\r\n */\r\nexport function getWeekNumber(date) {\r\n\t// Get the date for the first day of the year\r\n\tconst yearStart = new Date(date.getFullYear(), 0, 1);\r\n\r\n\t// Calculate the number of days since the start of the year until the given date\r\n\tconst daysSinceYearStart =\r\n\t\t(date.valueOf() - yearStart.valueOf()) / (1000 * 60 * 60 * 24);\r\n\r\n\t// Calculate the week number by dividing the number of days by 7 and rounding down\r\n\tconst weekNumber = Math.floor(daysSinceYearStart / 7) + 1;\r\n\r\n\treturn weekNumber;\r\n}\r\n\r\n/**\r\n * Returns the first date (Monday) of a given week in a year.\r\n * @param {number} year - The year of the target week.\r\n * @param {number} week - The week number (1-53) of the desired week.\r\n * @returns {Date} - The first date (Monday) of the specified week.\r\n */\r\nexport function getFirstDateOfWeek(year, week) {\r\n\t// Find the date of January 1st for the given year\r\n\tconst januaryFirst = new Date(year, 0, 1);\r\n\r\n\t// Calculate the number of days until the first Monday of the year\r\n\t// 0 represents Sunday, 1 represents Monday, and so on\r\n\tconst daysToFirstMonday = (8 - januaryFirst.getDay()) % 7;\r\n\r\n\t// Set the date object to the first Monday of the year\r\n\tconst firstMonday = new Date(januaryFirst);\r\n\tfirstMonday.setDate(januaryFirst.getDate() + daysToFirstMonday);\r\n\r\n\t// Calculate the number of days until the target Monday of the week\r\n\tconst daysToTargetMonday = (week - 1) * 7;\r\n\r\n\t// Set the date object to the target Monday of the week\r\n\tconst targetMonday = new Date(firstMonday);\r\n\ttargetMonday.setDate(firstMonday.getDate() + daysToTargetMonday);\r\n\r\n\treturn targetMonday;\r\n}\r\n\r\n/**\r\n * A collection of helper functions for working with input date values.\r\n * @namespace\r\n */\r\nexport const inputDateHelpers = {\r\n\t/**\r\n\t * Formats a date object to the desired string format based on the type.\r\n\t * @param {Date} date - The Date object to be formatted.\r\n\t * @param {string} type - The format type ('date', 'time', 'datetime-local', 'week', or 'month').\r\n\t * @returns {string} A formatted string based on the specified format.\r\n\t */\r\n\tformatDate,\r\n\r\n\t/**\r\n\t * Parses a string in the specified format and returns a Date object.\r\n\t * @param {string} dateString - The string to be parsed.\r\n\t * @param {string} type - The format type ('date', 'time', 'datetime-local', 'week', or 'month').\r\n\t * @returns {Date} - The parsed Date object.\r\n\t */\r\n\tparseDate,\r\n\r\n\t/**\r\n\t * Returns the week number of the year for a given date.\r\n\t * @param {Date} date - The date object for which to calculate the week number.\r\n\t * @returns {number} - The week number.\r\n\t */\r\n\tgetWeekNumber,\r\n\r\n\t/**\r\n\t * Returns the first date (Monday) of a given week in a year.\r\n\t * @param {number} year - The year of the target week.\r\n\t * @param {number} week - The week number (1-53) of the desired week.\r\n\t * @returns {Date} - The first date (Monday) of the specified week.\r\n\t */\r\n\tgetFirstDateOfWeek,\r\n};\r\n\r\nexport default inputDateHelpers;\r\n","/**\r\n * @typedef {undefined | null | false | 0 | ''} FalsyValues\r\n */\r\n\r\nimport { inputDateHelpers } from '.';\r\n\r\n/**\r\n * @template Value\r\n * @template DefaultValue\r\n * @typedef {Value extends FalsyValues ? DefaultValue : NonNullable<Value>} OnFalsyDefaultReturn\r\n */\r\n\r\n/**\r\n * @template Value\r\n * @template DefaultValue\r\n * @typedef {Value extends FalsyValues ? NonNullable<Value> : DefaultValue} OnTruthyDefaultReturn\r\n */\r\n\r\n/**\r\n * @template Value\r\n * @template DefaultValue\r\n * @typedef {Value extends null | undefined ? DefaultValue : Value} OnNullableDefaultReturn\r\n */\r\n\r\n/**\r\n * @template Value\r\n * @template DefaultValue\r\n * @typedef {Value extends null | undefined ? Value : DefaultValue} OnNotNullableDefaultReturn\r\n *\r\n * @description used to handle parsing and formatting (\"date\", \"time\", \"datetime-local\", \"week\", \"month\") and the cases of `null` like when clearing the input\r\n */\r\nexport const dateInput = {\r\n\t/**\r\n\t * @param {import(\"../..\").InputDateTypes} type\r\n\t * @description used to handle parsing (\"date\", \"time\", \"datetime-local\", \"week\", \"month\") and the cases of falsy values results to `null` like when clearing the input\r\n\t */\r\n\tparse: function (type) {\r\n\t\t/**\r\n\t\t * @param {string | number | FalsyValues} dateString\r\n\t\t */\r\n\t\treturn function (dateString) {\r\n\t\t\treturn !dateString ? null : inputDateHelpers.parseDate(dateString, type);\r\n\t\t};\r\n\t},\r\n\t/**\r\n\t * @param {import(\"../..\").InputDateTypes} type\r\n\t * @description used to handle formatting (\"date\", \"time\", \"datetime-local\", \"week\", \"month\") and the cases of falsy values results to '' like when clearing the input\r\n\t */\r\n\tformat: function (type) {\r\n\t\t/**\r\n\t\t * @param {Date | FalsyValues} dateString\r\n\t\t */\r\n\t\treturn function (dateString) {\r\n\t\t\treturn !dateString ? null : inputDateHelpers.formatDate(dateString, type);\r\n\t\t};\r\n\t},\r\n};\r\n\r\n/**\r\n * @template DefaultValue\r\n * @param {DefaultValue} defaultValue\r\n */\r\nexport function onNotNullableTo(defaultValue) {\r\n\t/**\r\n\t * @template Value\r\n\t * @param {Value} value\r\n\t */\r\n\treturn function (value) {\r\n\t\tconst symbol = Symbol();\r\n\t\tconst isNullable = value ?? symbol;\r\n\r\n\t\tif (isNullable !== symbol) {\r\n\t\t\treturn (\r\n\t\t\t\t/** @type {OnNullableDefaultReturn<Value, DefaultValue>} */\r\n\t\t\t\t(defaultValue)\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn (\r\n\t\t\t/** @type {OnNullableDefaultReturn<Value, DefaultValue>} */\r\n\t\t\t(value)\r\n\t\t);\r\n\t};\r\n}\r\nexport const onNullable = {\r\n\t/**\r\n\t * @template Value\r\n\t * @param {Value} value\r\n\t */\r\n\ttoEmptyString: function (value) {\r\n\t\treturn (\r\n\t\t\t/** @type {OnNullableDefaultReturn<Value, \"\">} */\r\n\t\t\t(value ?? '')\r\n\t\t);\r\n\t},\r\n\t/**\r\n\t * @template Value\r\n\t * @param {Value} value\r\n\t */\r\n\ttoUndefined: function (value) {\r\n\t\treturn (\r\n\t\t\t/** @type {OnNullableDefaultReturn<Value, undefined>} */\r\n\t\t\t(value ?? undefined)\r\n\t\t);\r\n\t},\r\n\t/**\r\n\t * @template Value\r\n\t * @param {Value} value\r\n\t */\r\n\ttoNull: function (value) {\r\n\t\treturn (\r\n\t\t\t/** @type {OnNullableDefaultReturn<Value, null>} */\r\n\t\t\t(value ?? null)\r\n\t\t);\r\n\t},\r\n\t/**\r\n\t * @template DefaultValue\r\n\t * @param {DefaultValue} defaultValue\r\n\t */\r\n\tto: function (defaultValue) {\r\n\t\t/**\r\n\t\t * @template Value\r\n\t\t * @param {Value} value\r\n\t\t */\r\n\t\treturn function (value) {\r\n\t\t\tconst symbol = Symbol();\r\n\t\t\tconst isNullable = value ?? symbol;\r\n\r\n\t\t\tif (isNullable === symbol) {\r\n\t\t\t\treturn (\r\n\t\t\t\t\t/** @type {OnNullableDefaultReturn<Value, DefaultValue>} */\r\n\t\t\t\t\t(defaultValue)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\treturn (\r\n\t\t\t\t/** @type {OnNullableDefaultReturn<Value, DefaultValue>} */\r\n\t\t\t\t(value)\r\n\t\t\t);\r\n\t\t};\r\n\t},\r\n\tfalsy: {\r\n\t\t/**\r\n\t\t * @template Value\r\n\t\t * @param {Value} value\r\n\t\t */\r\n\t\ttoEmptyString: function (value) {\r\n\t\t\treturn onNotNullableTo(\r\n\t\t\t\t/** @type {\"\"} */\r\n\t\t\t\t(''),\r\n\t\t\t)(value);\r\n\t\t},\r\n\t\t/**\r\n\t\t * @template Value\r\n\t\t * @param {Value} value\r\n\t\t */\r\n\t\ttoUndefined: function (value) {\r\n\t\t\treturn onNotNullableTo(undefined)(value);\r\n\t\t},\r\n\t\t/**\r\n\t\t * @template Value\r\n\t\t * @param {Value} value\r\n\t\t */\r\n\t\ttoNull: function (value) {\r\n\t\t\treturn onNotNullableTo(null)(value);\r\n\t\t},\r\n\t\t/**\r\n\t\t * @template DefaultValue\r\n\t\t * @param {DefaultValue} defaultValue\r\n\t\t */\r\n\t\tto: onNotNullableTo,\r\n\t},\r\n};\r\n\r\n/**\r\n * @template DefaultValue\r\n * @param {DefaultValue} defaultValue\r\n */\r\nfunction onFalsyTo(defaultValue) {\r\n\t/**\r\n\t * @template Value\r\n\t * @param {Value} value\r\n\t */\r\n\treturn function (value) {\r\n\t\treturn (\r\n\t\t\t/** @type {OnFalsyDefaultReturn<Value, DefaultValue>} */\r\n\t\t\t(!value ? defaultValue : value)\r\n\t\t);\r\n\t};\r\n}\r\n/**\r\n * @namespace\r\n * @property {object} onFalsy\r\n * @property {<Value>(value: Value) => OnFalsyDefaultReturn<Value, \"\">} onFalsy.toEmptyString\r\n * @property {<Value>(value: Value) => OnFalsyDefaultReturn<Value, undefined>} onFalsy.toUndefined\r\n * @property {<Value>(value: Value) => OnFalsyDefaultReturn<Value, null>} onFalsy.toNull\r\n * @property {<DefaultValue>(defaultValue: DefaultValue) => <Value>(value: Value) => OnFalsyDefaultReturn<Value, DefaultValue>} onFalsy.to\r\n */\r\nexport const onFalsy = {\r\n\ttoEmptyString: onFalsyTo(\r\n\t\t/** @type {\"\"} */\r\n\t\t(''),\r\n\t),\r\n\ttoUndefined: onFalsyTo(undefined),\r\n\ttoNull: onFalsyTo(null),\r\n\tto: onFalsyTo,\r\n};\r\n\r\n/**\r\n * @template DefaultValue\r\n * @param {DefaultValue} defaultValue\r\n */\r\nfunction onTruthyTo(defaultValue) {\r\n\t/**\r\n\t * @template Value\r\n\t * @param {Value} value\r\n\t */\r\n\treturn function (value) {\r\n\t\treturn (\r\n\t\t\t/** @type {OnTruthyDefaultReturn<Value, DefaultValue>} */\r\n\t\t\t(!value ? value : defaultValue)\r\n\t\t);\r\n\t};\r\n}\r\n/**\r\n * @namespace\r\n * @property {object} onTruthy\r\n * @property {<Value>(value: Value) => OnTruthyDefaultReturn<Value, \"\">} onTruthy.toEmptyString\r\n * @property {<Value>(value: Value) => OnTruthyDefaultReturn<Value, undefined>} onTruthy.toUndefined\r\n * @property {<Value>(value: Value) => OnTruthyDefaultReturn<Value, null>} onTruthy.toNull\r\n * @property {<DefaultValue>(defaultValue: DefaultValue) => <Value>(value: Value) => OnTruthyDefaultReturn<Value, DefaultValue>} onTruthy.to\r\n */\r\nexport const onTruthy = {\r\n\ttoEmptyString: onTruthyTo(\r\n\t\t/** @type {\"\"} */\r\n\t\t(''),\r\n\t),\r\n\ttoUndefined: onTruthyTo(undefined),\r\n\ttoNull: onTruthyTo(null),\r\n\tto: onTruthyTo,\r\n};\r\n\r\nconst formFieldValueHelpers = {\r\n\tonDateInput: dateInput,\r\n\tonNullable,\r\n\tonFalsy,\r\n\tonTruthy,\r\n};\r\n\r\nexport default formFieldValueHelpers;\r\n\r\n/*\r\nconst test_1 = [1, 2, 3];\r\nconst result_1 = {\r\n\tto: formFieldValueHelpers.onFalsy.to('lol')(test_1),\r\n\temptyString: formFieldValueHelpers.onFalsy.toEmptyString(test_1),\r\n\tnull: formFieldValueHelpers.onFalsy.toNull(test_1),\r\n\tundefined: formFieldValueHelpers.onFalsy.toUndefined(test_1),\r\n};\r\nresult_1;\r\n\r\nconst test_1_2 = 0;\r\nconst result_1_2 = {\r\n\tto: formFieldValueHelpers.onFalsy.to('lol')(test_1_2),\r\n\temptyString: formFieldValueHelpers.onFalsy.toEmptyString(test_1_2),\r\n\tnull: formFieldValueHelpers.onFalsy.toNull(test_1_2),\r\n\tundefined: formFieldValueHelpers.onFalsy.toUndefined(test_1_2),\r\n};\r\nresult_1_2;\r\n\r\nconst test_2 = [1, 2, 3];\r\nconst result_2 = {\r\n\tto: formFieldValueHelpers.onNullable.to('lol')(test_2),\r\n\temptyString: formFieldValueHelpers.onNullable.toEmptyString(test_2),\r\n\tnull: formFieldValueHelpers.onNullable.toNull(test_2),\r\n\tundefined: formFieldValueHelpers.onNullable.toUndefined(test_2),\r\n};\r\nresult_2;\r\n\r\nconst test_2_2 = null;\r\nconst result_2_2 = {\r\n\tto: formFieldValueHelpers.onNullable.to('lol')(test_2_2),\r\n\temptyString: formFieldValueHelpers.onNullable.toEmptyString(test_2_2),\r\n\tnull: formFieldValueHelpers.onNullable.toNull(test_2_2),\r\n\tundefined: formFieldValueHelpers.onNullable.toUndefined(test_2_2),\r\n};\r\nresult_2_2;\r\n\r\nconst test_3 = [1, 2, 3];\r\nconst result_3 = {\r\n\tto: formFieldValueHelpers.onNullable.falsy.to('lol')(test_3),\r\n\temptyString: formFieldValueHelpers.onNullable.falsy.toEmptyString(test_3),\r\n\tnull: formFieldValueHelpers.onNullable.falsy.toNull(test_3),\r\n\tundefined: formFieldValueHelpers.onNullable.falsy.toUndefined(test_3),\r\n};\r\nresult_3;\r\n\r\nconst test_3_2 = null;\r\nconst result_3_2 = {\r\n\tto: formFieldValueHelpers.onNullable.to('lol')(test_3_2),\r\n\temptyString: formFieldValueHelpers.onNullable.toEmptyString(test_3_2),\r\n\tnull: formFieldValueHelpers.onNullable.toNull(test_3_2),\r\n\tundefined: formFieldValueHelpers.onNullable.toUndefined(test_3_2),\r\n};\r\nresult_3_2;\r\n*/\r\n"],"mappings":"AAMO,SAASA,EAAWC,EAAMC,EAAM,CAEtC,IAAIC,EAAgB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AGhBF,EAMDC,CAEH,CACD,CACO,IAAME,EAAa,CAKzB,cAAe,SAAUF,EAAO,CAC/B,OAEEA,GAAS,EAEZ,EAKA,YAAa,SAAUA,EAAO,CAC7B,OAEEA,GAAS,MAEZ,EAKA,OAAQ,SAAUA,EAAO,CACxB,OAEEA,GAAS,IAEZ,EAKA,GAAI,SAAUD,EAAc,CAK3B,OAAO,SAAUC,EAAO,CACvB,IAAMC,EAAS,OAAO,EAGtB,OAFmBD,GAASC,KAETA,EAGhBF,EAMDC,CAEH,CACD,EACA,MAAO,CAKN,cAAe,SAAUA,EAAO,CAC/B,OAAOF,EAEL,EACF,EAAEE,CAAK,CACR,EAKA,YAAa,SAAUA,EAAO,CAC7B,OAAOF,EAAgB,MAAS,EAAEE,CAAK,CACxC,EAKA,OAAQ,SAAUA,EAAO,CACxB,OAAOF,EAAgB,IAAI,EAAEE,CAAK,CACnC,EAKA,GAAIF,CACL,CACD,EAMA,SAASK,EAAUJ,EAAc,CAKhC,OAAO,SAAUC,EAAO,CACvB,OAEGA,GAAQD,CAEZ,CACD,CASO,IAAMK,EAAU,CACtB,cAAeD,EAEb,EACF,EACA,YAAaA,EAAU,MAAS,EAChC,OAAQA,EAAU,IAAI,EACtB,GAAIA,CACL,EAMA,SAASE,EAAWN,EAAc,CAKjC,OAAO,SAAUC,EAAO,CACvB,OAEGA,GAAgBD,CAEpB,CACD,CASO,IAAMO,EAAW,CACvB,cAAeD,EAEb,EACF,EACA,YAAaA,EAAW,MAAS,EACjC,OAAQA,EAAW,IAAI,EACvB,GAAIA,CACL,EAEME,EAAwB,CAC7B,YAAab,EACb,WAAAQ,EACA,QAAAE,EACA,SAAAE,CACD,EAEOE,EAAQD","names":["formatDate","date","type","formattedDate","year","weekNumber","getWeekNumber","parseDate","dateString","parsedDate","hours","minutes","seconds","yearString","weekString","week","getFirstDateOfWeek","yearStart","daysSinceYearStart","januaryFirst","daysToFirstMonday","firstMonday","daysToTargetMonday","targetMonday","inputDateHelpers","dateInput","type","dateString","inputDateHelpers","onNotNullableTo","defaultValue","value","symbol","onNullable","onFalsyTo","onFalsy","onTruthyTo","onTruthy","formFieldValueHelpers","fieldValue_default"]}