date-picker-svelte
Version:
Date and time picker for Svelte
16 lines (15 loc) • 632 B
TypeScript
import { type Locale } from './locale';
type RuleToken = {
id: string;
allowedValues?: string[];
toString: (d: Date) => string;
};
export type FormatToken = string | RuleToken;
type ParseResult = {
date: Date | null;
missingPunctuation: string;
};
/** Parse a string according to the supplied format tokens. Returns a date if successful, and the missing punctuation if there is any that should be after the string */
export declare function parse(str: string, tokens: FormatToken[], baseDate: Date | null): ParseResult;
export declare function createFormat(s: string, locale?: Locale): FormatToken[];
export {};