Date Value Formatter (Properties/DateValue.tsx)

ui-extensions-examples · legacy-card-converter/src/app/cards/components/Properties/DateValue.tsx · typescript · MIT
ui, dev-tools, crm, fw:react

A UI component that displays formatted dates based on a provided locale. Use this to ensure consistent date presentation in HubSpot extensions.

// Source: https://github.com/HubSpot/ui-extensions-examples | License: MIT | Copyright 2022 HubSpot
// Provided via justclaw.it.com; keep this notice with the code.
import { Text } from '@hubspot/ui-extensions';

import { formatDate } from '../../utils/propertyFormatters';

export interface DateValueProps {
  value: string | number;
  locale?: string;
  testId?: string;
}

export function DateValue({ value, locale, testId }: DateValueProps) {
  return (
    <Text inline={true} testId={testId}>
      {formatDate(value, locale)}
    </Text>
  );
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key