I use the esm version of date-fns and you can use the same type of formats that moment uses :

import { format } from 'date-fns/esm'
import { enUS, fr } from 'date-fns/esm/locale'

I'll store the locales in an object :

this.dateLocales = { fr: fr, en: enUS }

and use these formats :

LT: 'h:mm aa',
LTS: 'h:mm:ss aa',
L: 'MM/DD/YYYY',
LL: 'MMMM D YYYY',
LLL: 'MMMM D YYYY h:mm aa',
LLLL: 'dddd, MMMM D YYYY h:mm aa'

So you can do :

format(
  new Date(2014, 6, 2),
  'LL',
  {locale: this.dateLocales.fr}
)

Those formats are localised

Answer from Lakston on Stack Overflow
🌐
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js. ... import { format, formatDistance, formatRelative, subDays } from 'date-fns' format(new Date(), "'Today is a' eeee") //=> "Today is a Monday" formatDistance(subDays(new Date(), 3), new Date(), { addSuffix: true }) //=> "3 days ago" formatRelative(subDays(new Date(), 3), new Date()) //=> "last Friday at 7:26 p.m."
🌐
GitHub
github.com › date-fns › date-fns › blob › main › docs › i18n.md
date-fns/docs/i18n.md at main · date-fns/date-fns
It might seem complicated to require and pass locales as options, but unlike Moment.js which bloats your build with all the locales by default date-fns forces developer to manually require locales when needed. To make API simple, we encourage you to write tiny wrappers and use those instead of original functions: // app/_lib/format.js import { format } from "date-fns"; import { enGB, eo, ru } from "date-fns/locale"; const locales = { enGB, eo, ru }; // by providing a default string of 'PP' or any of its variants for `formatStr` // it will format dates in whichever way is appropriate to the loc
Author   date-fns
🌐
npm
npmjs.com › package › date-fns
date-fns - npm
I18n: Dozens of locales. Include only what you need. ... import { compareAsc, format } from "date-fns"; format(new Date(2014, 1, 11), "yyyy-MM-dd"); //=> '2014-02-11' const dates = [ new Date(1995, 6, 2), new Date(1987, 1, 11), new Date(1989, 6, 10), ]; dates.sort(compareAsc); //=> [ // Wed Feb 11 1987 00:00:00, // Mon Jul 10 1989 00:00:00, // Sun Jul 02 1995 00:00:00 // ]
      » npm install date-fns
    
Published   Sep 17, 2024
Version   4.1.0
🌐
GitHub
github.com › date-fns › date-fns › issues › 2591
Function to get country/language date format strings · Issue #2591 · date-fns/date-fns
August 12, 2021 - For example, if I passed the language preference from Window.navigator.language, I would love to see the date format strings for that language. Something along the lines of: import getFormatString from 'date-fns/getFormatString' const result = getFormatString(navigator.language); // result = "MM/DD/YYYY"
Published   Aug 12, 2021
🌐
MUI X
mui.com › x › react-date-pickers › adapters-locale
Date and Time Pickers - Date format and localization - MUI X
Locale default · AM / PM · 06:30 PM · AM / PM · 24 hours · 18:30 · 24 hours · The format received by the props described below depends on the date library you are using. Please refer to each library's documentation for the full format table: Day.js · date-fns ·
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-date-fns
Quick Tour of date-fns, a Simple JavaScript Date Library | DigitalOcean
March 18, 2020 - For this, we can import specific locale plugins: const format = require('date-fns/format'); const russianLocale = require('date-fns/locale/ru'); const stPattysDay = new Date('2020/03/17'); const formattedDate = format(stPattysDay, 'MMMM dd, yyyy', { locale: russianLocale }); console.log(formattedDate); // => "марта 17, 2020" The ability to calculate the differences between 2 dates is important for a date manipulation library.
🌐
date-fns
date-fns.org › v1.29.0 › docs › format
date-fns format
The result may vary by locale. CommonJS · UMD · ES 2015 · var format = require('date-fns/format') format(date, [format], [options]) Represent 11 February 2014 in middle-endian format: var result = format( new Date(2014, 1, 11), 'MM/DD/YYYY' ) //=> '02/11/2014' Represent 2 July 2014 in Esperanto: var eoLocale = require('date-fns/locale/eo') var result = format( new Date(2014, 6, 2), 'Do [de] MMMM YYYY', {locale: eoLocale} ) //=> '2-a de julio 2014' Suggest edits by sending a PR ·
🌐
GitHub
github.com › date-fns › date-fns
GitHub - date-fns/date-fns: ⏳ Modern JavaScript date utility library ⌛️
I18n: Dozens of locales. Include only what you need. ... import { compareAsc, format } from "date-fns"; format(new Date(2014, 1, 11), "yyyy-MM-dd"); //=> '2014-02-11' const dates = [ new Date(1995, 6, 2), new Date(1987, 1, 11), new Date(1989, 6, 10), ]; dates.sort(compareAsc); //=> [ // Wed Feb 11 1987 00:00:00, // Mon Jul 10 1989 00:00:00, // Sun Jul 02 1995 00:00:00 // ]
Author   date-fns
🌐
npm
npmjs.com › package › date-fns-tz
date-fns-tz - npm
This function takes a Date instance in the system's local time or an ISO8601 string, and an IANA time zone name or offset string. It then formats this date in the target time zone regardless of the system's local time zone.
      » npm install date-fns-tz
    
Published   Sep 30, 2024
Version   3.2.0
Author   Marnus Weststrate
🌐
GitHub
github.com › date-fns › date-fns › blob › main › docs › i18nContributionGuide.md
date-fns/docs/i18nContributionGuide.md at main · date-fns/date-fns
See the list here: * // https://www.loc.gov/standards/iso639-2/php/code_list.php * // Used by https://date-fns.org/ to detect the list of the countries that uses the language. * @iso-639-2 eng * * // Authors of the locale (including anyone who corrected or fixed the locale) * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp} * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss} */ var locale = { code: "en", formatDistance: formatDistance, formatLong: formatLong, formatRelative: formatRelative, localize: localize, match: match, options: { // Index of the first day of the week.
Author   date-fns
🌐
David Berri
dberri.com › formatting-dates-in-javascript-using-the-users-locale
Formatting dates in JavaScript using the user's locale
November 1, 2021 - const myDate = new Date(2021, 10, 1); let formatter = new Intl.DateTimeFormat('en-US'); console.log(formatter.format(myDate)) // "11/1/2021" formatter = new Intl.DateTimeFormat('pt-BR'); console.log(formatter.format(myDate)) // "01/11/2021" formatter = new Intl.DateTimeFormat('de-DE'); console.log(formatter.format(myDate)) // "1.11.2021"
🌐
Five9
documentation.five9.com › bundle › studio-combo › page › studio-build › content-types › function-date-fns.htm
JavaScript date-fns with Studio
Skip to main contentSkip to search · Powered by Zoomin Software. For more details please contactZoomin · © 2026 Five9, Inc. All Rights Reserved · Privacy PolicyTerms of Use · Powered By
🌐
Reactarchitect
reactarchitect.ai › examples › date-fns › locale
React Architect - Generate documentation automatically and visualize your javascript, react or nextjs projects using the power of AI
import { enUS, es, fr } from 'date-fns/locale'; const currentDate = new Date(); // Example usage in React component const MyComponent = () => { return ( <div> <p>{format(currentDate, 'EEEE, MMMM do yyyy', { locale: enUS })}</p> <p>{format(currentDate, 'P', { locale: es })}</p> <p>{format(currentDate, 'PP', { locale: fr })}</p> </div> ); };