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";

It has a slightly different function signature then the format function, where you need to pass the options as the first argument.

const formatMonth = format({ locale: de }, "MMM");

Answer from knoefel on Stack Overflow
🌐
GitHub
github.com › orgs › date-fns › discussions › 2724
List of all locales and corresponding languages? · date-fns · Discussion #2724
I went to the repo, and found the folders named according to the languages supported. Documentation could be better https://github.com/date-fns/date-fns/tree/main/src/locale
Discussions

moment vs date-fns locale date formats
Is there some way of printing out, say, a "short date" for a particular locale without me telling DateFns what the format for that locale is? ... It is supposed to be available in [email protected] (not released yet, alpha-7 version in progress) date-fns.org/v2.0.0-alpha.7/docs/format More on stackoverflow.com
🌐 stackoverflow.com
javascript - Failing to "dynamically" import date-fns/locale libs - TypeScript giving an attempted import error - Stack Overflow
The problem is, some of the locales are in different code format (for example, support for deutsch language is enabled when the backend response includes code: 'deDE', but the corresponding date-fns package is just 'de'. On the other hand date-fns package for english is 'enUS', not just 'en'. More on stackoverflow.com
🌐 stackoverflow.com
Link to list of locales
Cannot find the list of available locales. Please link to the list or the code from here in the documentation: More on github.com
🌐 github.com
2
December 15, 2021
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 › docs › Locale
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
🌐
MUI X
mui.com › x › react-date-pickers › adapters-locale
Date and Time Pickers - Date format and localization - MUI X
// with date-fns v3.x or v4.x import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; // with date-fns v2.x import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV2'; // with date-fns v3.x or v4.x import { de } from 'date-fns/locale/de'; // with date-fns v2.x import de from 'date-fns/locale/de'; <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={de}> {children} </LocalizationProvider>; CopyCopied(or $keyC)
🌐
GitHub
github.com › date-fns › date-fns › discussions › 2724
List of all locales and corresponding languages? · date-fns/date-fns · Discussion #2724
October 25, 2021 - [ { "code": "af", "iso_639_2": "afr", "summary": "Afrikaans locale", "language": "Afrikaans" }, { "code": "ar-DZ", "iso_639_2": "ara", "summary": "Arabic locale (Algerian Arabic)", "language": "Algerian Arabic" }, { "code": "ar-MA", "iso_639_2": "ara", "summary": "Arabic locale (Moroccan Arabic)", "language": "Moroccan Arabic" }, { "code": "ar-SA", "iso_639_2": "ara", "summary": "Arabic locale (Sauid Arabic)", "language": "Arabic" }, { "code": "ar-TN", "iso_639_2": "ara", "summary": "Arabic locale (Tunisian Arabic)", "language": "Arabic" }, { "code": "az", "iso_639_2": "aze", "summary": "Azerb
Author   date-fns
Find elsewhere
🌐
David Berri
dberri.com › formatting-dates-in-javascript-using-the-users-locale
Formatting dates in JavaScript using the user's locale
November 1, 2021 - Currently, there are multiple libraries to format dates in JavaScript. I used moment.js for a long time, but the bundle size was always a turn down for me. Then I switched to date-fns, which has a simple API and supports tree-shaking, and I have one project where I'm using luxon.
🌐
SitePoint
sitepoint.com › blog › javascript › managing dates and times in javascript using date-fns
Managing Dates and Times in JavaScript Using date-fns — SitePoint
November 13, 2024 - It might seem complicated to require ... needed. You can view a list of available locales by looking in the node_modules/date-fns/locale folder in your project....
🌐
GitHub
github.com › date-fns › date-fns › issues › 2852
Link to list of locales · Issue #2852 · date-fns/date-fns
December 15, 2021 - date-fns / date-fns Public · There was an error while loading. Please reload this page. Notifications · You must be signed in to change notification settings · Fork 1.9k · Star 36.4k · New issueCopy link · New issueCopy link · Open · Open · Link to list of locales#2852 ·
Author   amandapouget
🌐
npm
npmjs.com › package › date-fns-tz
date-fns-tz - npm
Since date-fns always returns a plain JS Date, which implicitly has the current system's time zone, helper functions are provided for handling common time zone related use cases. 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.
      » npm install date-fns-tz
    
Published   Sep 30, 2024
Version   3.2.0
Author   Marnus Weststrate
🌐
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. and many more benefits · 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 // ] The library is available as an npm package.
Starred by 36.5K users
Forked by 1.9K users
Languages   TypeScript
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-date-fns
Quick Tour of date-fns, a Simple JavaScript Date Library | DigitalOcean
March 18, 2020 - This makes date-fns a much smaller dependency than Moment.js. See the graphic below for the bundle sizes of Moment.js vs date-fns: ... Note that there’s a way to configure webpack to exclude the “locale” plugins.