Favivon - Correção

This commit is contained in:
2026-05-30 19:59:39 -03:00
parent 76ddaa815d
commit d7dfd221f0
32859 changed files with 5459654 additions and 404 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { Locale } from "date-fns";
import React from "react";
import { DateLib, type DateLibOptions } from "../index.js";
import type { DayPickerProps } from "../types/props.js";
export declare const th: import("../index.js").DayPickerLocale;
export declare const enUS: import("../index.js").DayPickerLocale;
/**
* Render the Buddhist (Thai) calendar.
*
* Months/weeks are Gregorian; displayed year is Buddhist Era (BE = CE + 543).
* Thai digits are used by default.
*
* Defaults:
*
* - `locale`: `th`
* - `dir`: `ltr`
* - `numerals`: `thai`
*/
export declare function DayPicker(props: DayPickerProps & {
locale?: Locale;
dir?: DayPickerProps["dir"];
numerals?: DayPickerProps["numerals"];
dateLib?: DayPickerProps["dateLib"];
}): React.JSX.Element;
/** Returns the date library used in the Buddhist calendar. */
export declare const getDateLib: (options?: DateLibOptions) => DateLib;
+48
View File
@@ -0,0 +1,48 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDateLib = exports.enUS = exports.th = void 0;
exports.DayPicker = DayPicker;
const react_1 = __importDefault(require("react"));
const index_js_1 = require("../index.js");
const en_US_js_1 = require("../locale/en-US.js");
const th_js_1 = require("../locale/th.js");
const format_js_1 = require("./lib/format.js");
// Adapter to match DateLib's format signature without using `any`.
const buddhistFormat = (date, formatStr, options) => {
return (0, format_js_1.format)(date, formatStr, options);
};
exports.th = th_js_1.th;
exports.enUS = en_US_js_1.enUS;
/**
* Render the Buddhist (Thai) calendar.
*
* Months/weeks are Gregorian; displayed year is Buddhist Era (BE = CE + 543).
* Thai digits are used by default.
*
* Defaults:
*
* - `locale`: `th`
* - `dir`: `ltr`
* - `numerals`: `thai`
*/
function DayPicker(props) {
const dateLib = (0, exports.getDateLib)({
locale: props.locale ?? exports.th,
weekStartsOn: props.broadcastCalendar ? 1 : props.weekStartsOn,
firstWeekContainsDate: props.firstWeekContainsDate,
useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,
timeZone: props.timeZone,
});
return (react_1.default.createElement(index_js_1.DayPicker, { ...props, locale: props.locale ?? exports.th, numerals: props.numerals ?? "thai", dir: props.dir ?? "ltr", dateLib: dateLib }));
}
/** Returns the date library used in the Buddhist calendar. */
const getDateLib = (options) => {
return new index_js_1.DateLib(options, {
format: buddhistFormat,
});
};
exports.getDateLib = getDateLib;
+3
View File
@@ -0,0 +1,3 @@
import type { DateLibOptions } from "../../classes/DateLib.js";
/** Format override adding +543 to year tokens for Buddhist Era (BE). */
export declare function format(date: Date, formatStr: string, options?: DateLibOptions): string;
+30
View File
@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.format = format;
const date_fns_1 = require("date-fns");
/** Format override adding +543 to year tokens for Buddhist Era (BE). */
function format(date, formatStr, options) {
const beYear = date.getFullYear() + 543;
switch (formatStr) {
case "LLLL y":
case "LLLL yyyy":
return `${(0, date_fns_1.format)(date, "LLLL", options)} ${beYear}`;
case "LLLL":
return (0, date_fns_1.format)(date, "LLLL", options);
case "yyyy":
return String(beYear).padStart(4, "0");
case "y":
return String(beYear);
case "yyyy-MM":
return `${beYear}-${(0, date_fns_1.format)(date, "MM", options)}`;
case "yyyy-MM-dd":
return `${beYear}-${(0, date_fns_1.format)(date, "MM", options)}-${(0, date_fns_1.format)(date, "dd", options)}`;
case "PPP":
case "PPPP": {
const raw = (0, date_fns_1.format)(date, formatStr, options);
return raw.replace(/(.*)(\d{4})(?!.*\d)/, (_m, pre) => `${pre}${beYear}`);
}
default:
return (0, date_fns_1.format)(date, formatStr, options);
}
}