Widgets
Datetime

Datetime

Make dates and times human readable.

Anatomy

import { Datetime } from "@lualtek/react-components";
 
export default () => {
  return <Datetime date="2021-12-15T16:00:32.507981+00:00" />;
};

API Reference

export type DatetimeProps = HTMLAttributes<HTMLTimeElement> & {
  /**
   * The date to format and display.
   */
  date: string;
 
  /**
   * Set the locale to use to format the date.
   * @default 'en-US'
   */
  locale?: string | string[];
 
  /**
   * Customize the date format by passing options from Intl.DateTimeFormat
   *
   * Read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
   */
  options?: Intl.DateTimeFormatOptions;
};