@de100/form-echo
Version:
A form state management for fields validations and errors
1 lines • 21.2 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,SAAS,WAAW,MAAM,MAAM;AAEtC,MAAI,gBAAgB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