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
🌐
GitHub
github.com › date-fns › date-fns › blob › main › docs › i18n.md
date-fns/docs/i18n.md at main · date-fns/date-fns
// 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 locale export default function (date, formatStr = "PP") { return format(date, formatStr, { locale: locales[window.__localeId__], // or global.__localeId__ }); } // Later: import format from "app/_lib/format"; window.__localeId__ = "enGB"; format(friday13, "EEEE d"); //=> 'Friday 13' window.__localeId__ = "eo"; format(friday13, "EEEE d"); //=> 'vendredo 13' // If the format string is omitted, it will take the default for the locale.
Author   date-fns
Discussions

Date-fns format and locale problem
Hi, I used the sample from Material UI and tried to modify it. I am having a bit of trouble trying to do locale on a Material UI datepicker with a custom format but I am not sure what I am doing wrong… Below is the link to my code so far: More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
May 25, 2021
Function to get country/language date format strings
One cool feature of MomentJS is that they give functionality to retrieve the format string of a specific country/language. It would be amazing to have this feature in date-fns. For example, if I pa... More on github.com
🌐 github.com
6
August 12, 2021
Localize date-fns - javascript
As you are using the FP version to format a date you need to use the formatWithOptions function to pass the locale options. import format from "date-fns/fp/formatWithOptions"; More on stackoverflow.com
🌐 stackoverflow.com
Format date according user locale with date-fns
I'm using date-fns and I would like to display dates as per user’s selected locale (language+region) for example: “Jan 12, 2021” for en_US or “12 Jan 2021.” for en_CA., There is a way to achieve this More on stackoverflow.com
🌐 stackoverflow.com
🌐
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.
🌐
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"
Author   kylejw2
🌐
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 // ]
Starred by 36.5K users
Forked by 1.9K users
Languages   TypeScript
Find elsewhere
🌐
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 ·
🌐
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 ·
🌐
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"
🌐
GitHub
github.com › date-fns › date-fns › blob › main › docs › i18nContributionGuide.md
date-fns/docs/i18nContributionGuide.md at main · date-fns/date-fns
September 13, 2022 - 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
🌐
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
🌐
Five9
documentation.five9.com › bundle › studio-combo › page › studio-build › content-types › function-date-fns.htm
JavaScript date-fns with Studio
October 16, 2025 - 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
🌐
Stack Overflow
stackoverflow.com › questions › 76017714 › date-fns-how-to-format-dates-for-multiple-languages
date-fns: How to format dates for multiple languages?
import en from 'date-fns/locale/en'; import fr from 'date-fns/locale/fr'; import es from 'date-fns/locale/es'; import { format } from 'date-fns'; ...