@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
49 lines (45 loc) • 1.5 kB
JavaScript
"use client";
import { styled } from "../../core/system/factory.js";
import { createComponent } from "../../core/components/create-component.js";
import { formatDateTimeStyle } from "./format-date-time.style.js";
import { useFormatDateTime } from "./use-format-date-time.js";
import { jsx } from "react/jsx-runtime";
//#region src/components/format/format-date-time.tsx
const { PropsContext: FormatDateTimePropsContext, usePropsContext: useFormatDateTimePropsContext, withContext } = createComponent("format-date-time", formatDateTimeStyle);
/**
* `Format` is used to format dates, numbers, and bytes according to a specific locale.
*
* @see https://yamada-ui.com/docs/components/format
*/
const FormatDateTime = withContext(({ calendar, dateStyle, day, dayPeriod, era, formatMatcher, fractionalSecondDigits, hour, hour12, hourCycle, locale, localeMatcher, minute, month, numberingSystem, second, timeStyle, timeZone, timeZoneName, value, weekday, year,...rest }) => {
const text = useFormatDateTime(value, {
calendar,
dateStyle,
day,
dayPeriod,
era,
formatMatcher,
fractionalSecondDigits,
hour,
hour12,
hourCycle,
locale,
localeMatcher,
minute,
month,
numberingSystem,
second,
timeStyle,
timeZone,
timeZoneName,
weekday,
year
});
return /* @__PURE__ */ jsx(styled.span, {
...rest,
children: text
});
})();
//#endregion
export { FormatDateTime, FormatDateTimePropsContext, useFormatDateTimePropsContext };
//# sourceMappingURL=format-date-time.js.map