diff --git a/.eslintrc.js b/.eslintrc.js index 0661183101ab..33be8cb62fcd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,6 +51,10 @@ const restrictedImportPaths = [ name: '@styles/theme/illustrations', message: 'Do not import theme illustrations directly. Please use the `useThemeIllustrations` hook instead.', }, + { + name: 'date-fns/locale', + message: "Do not import 'date-fns/locale' directly. Please use the submodule import instead, like 'date-fns/locale/en-GB'.", + }, ]; const restrictedImportPatterns = [ diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index 6da5c8af1ff2..4d4f8d425681 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -27,7 +27,8 @@ import { subMinutes, } from 'date-fns'; import {formatInTimeZone, format as tzFormat, utcToZonedTime, zonedTimeToUtc} from 'date-fns-tz'; -import {enGB, es} from 'date-fns/locale'; +import enGB from 'date-fns/locale/en-GB'; +import es from 'date-fns/locale/es'; import throttle from 'lodash/throttle'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest';