Skip to main content

formatDate

Formats a date value into a localized string representation using the toLocaleDateString() method.

API

interface IFormatDateConfig {
date: ConstructorParameters<typeof Date>[0];
locales?: Intl.LocalesArgument;
options?: Intl.DateTimeFormatOptions;
}

function formatDate(config: IFormatDateConfig): string;

Usage

import { formatDate } from "@feedzai/js-utilities";

const formattedDate = formatDate({ date: "2023-12-25" });

console.log(formattedDate); // "December 25"