UNPKG

vremel

Version:

JavaScript date utility library for Temporal API

61 lines 4.31 kB
import type { Temporal } from "../types.js"; export interface FormatWithoutLocaleOptions { /** * whether format numeric year/month/day for non-ISO calendar */ formatNonIsoDate?: boolean; } /** * Returns formatted date string of the Temporal object in the given format. * When formatting year, month, or day, this function only accepts a temporal object with ISO calendar by default. * If you are 100% sure what you are doing and want to format numeric date info of non-ISO date intentionally, * pass `formatNonIsoDate` option. * * Characters between two single quotes (`'`) in the format are escaped. * Two consecutive single quotes (`''`) in the format always represents one single quote (`'`). * Letters `A` to `Z` and `a` to `z` are reserved for use as pattern characters, unless they are escaped. * * Available field patterns are subset of date field symbols in Unicode CLDR, * see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table for details. * * Available patterns: * | unit | pattern | result examples | * | ------------------ | ---------------- | --------------------------------------- | * | calendar year | y | 2, 20, 201, 2000, 20020 | * | | yy | 02, 20, 01, 00, 20 | * | | yyy | 002, 020, 201, 2000, 20020 | * | | yyyy | 0002, 0020, 0201, 2000, 20020 | * | | yyyyy, yyyyyy... | (at least `n` digits with zero-padding) | * | month | M | 1, 12 | * | | MM | 01, 12 | * | day | d | 1, 31 | * | | dd | 01, 31 | * | hour (1-12) | h | 12, 1, 11 | * | | hh | 12, 01, 11 | * | hour (0-23) | H | 0, 1, 23 | * | | HH | 00, 01, 23 | * | minute | m | 0, 59 | * | | mm | 00, 59 | * | second | s | 0, 59 | * | | ss | 00, 59 | * | fraction of second | S | 1, 8 | * | | SS | 10, 83 | * | | SSS, SSSS... | (`n` digits) | * | timezone offset | x | -08, +0530, +00 | * | | xx | -0800, +0530, +0000 | * | | xxx | -08:00, +05:30, +00:00 | * | | xxxx | -0800, +0530, +0000, +123456 | * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | * | timezone offset | X | -08, +0530, Z | * | | XX | -0800, +0530, Z | * | | XXX | -08:00, +05:30, Z | * | | XXXX | -0800, +0530, Z, +123456 | * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | * | time zone ID | VV | Europe/London, Etc/GMT+1 | * * @param dateTime Temporal object * @param format pattern string * @returns formatted date */ export declare function formatWithoutLocale(dateTime: Temporal.ZonedDateTime | Temporal.PlainDate | Temporal.PlainTime | Temporal.PlainDateTime | Temporal.PlainYearMonth | Temporal.PlainMonthDay, format: string, options?: FormatWithoutLocaleOptions): string; //# sourceMappingURL=formatWithoutLocale.d.ts.map