UNPKG

@de100/form-echo

Version:

A form state management for fields validations and errors

41 lines (38 loc) 1.74 kB
import { I as InputDateTypes } from '../../fieldValue-b1db7b35.js'; export { g as formFieldValueHelpers, o as onFalsy, h as onNullable, i as onTruthy } from '../../fieldValue-b1db7b35.js'; import 'react'; import 'zod'; /** * Formats a date object to the desired string format based on the type. * @param {Date} date - The Date object to be formatted. * @param {import("../..").InputDateTypes} type - The format type ('date', 'time', 'datetime-local', 'week', or 'month'). * @returns {string} A formatted string based on the specified format. */ declare function formatDate(date: Date, type: InputDateTypes): string; /** * Parses a string in the specified format and returns a Date object. * @param {string | number} dateString - The string to be parsed. * @param {string} type - The format type ('date', 'time', 'datetime-local', 'week', or 'month'). * @returns {Date} - The parsed Date object. */ declare function parseDate(dateString: string | number, type: string): Date; /** * Returns the week number of the year for a given date. * @param {Date} date - The date object for which to calculate the week number. * @returns {number} - The week number. */ declare function getWeekNumber(date: Date): number; /** * Returns the first date (Monday) of a given week in a year. * @param {number} year - The year of the target week. * @param {number} week - The week number (1-53) of the desired week. * @returns {Date} - The first date (Monday) of the specified week. */ declare function getFirstDateOfWeek(year: number, week: number): Date; declare namespace inputDateHelpers { export { formatDate }; export { parseDate }; export { getWeekNumber }; export { getFirstDateOfWeek }; } export { inputDateHelpers };