diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index c16eb3c4ac..61cc2f9ff2 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -49,6 +49,10 @@ jobs:
- uses: ./.github/actions/build_cache_read
- name: Tests
run: yarn test
+ - name: Log file content
+ run: |
+ echo "Contenu du fichier transpiled/react/stylesheet.css :"
+ cat ./transpiled/react/stylesheet.css
- name: BundleMon
uses: lironer/bundlemon-action@v1
argosDesktop:
diff --git a/package.json b/package.json
index 6b6c56f5f7..d97ad4ee3b 100644
--- a/package.json
+++ b/package.json
@@ -162,7 +162,7 @@
"chart.js": "3.7.1",
"classnames": "^2.2.5",
"cozy-interapp": "^0.5.4",
- "date-fns": "^1.28.5",
+ "date-fns": "2.30.0",
"filesize": "8.0.7",
"hammerjs": "^2.0.8",
"intersection-observer": "0.11.0",
diff --git a/react/BarContextProvider/index.spec.jsx b/react/BarContextProvider/index.spec.jsx
index b53fff9b73..823072a36d 100644
--- a/react/BarContextProvider/index.spec.jsx
+++ b/react/BarContextProvider/index.spec.jsx
@@ -22,7 +22,7 @@ const DumbHelloWorld = translate()(({ t, f, lang }) => (
@@ -93,7 +93,7 @@ const dateMonthProp = function (props, propName, componentName) {
'` supplied to' +
' `' +
componentName +
- '`. Should be in the form YYYY-MM.'
+ '`. Should be in the form yyyy-LL.'
)
}
}
diff --git a/react/FilePicker/FilePickerBodyItem.jsx b/react/FilePicker/FilePickerBodyItem.jsx
index 8f913f054d..b5d35c8892 100644
--- a/react/FilePicker/FilePickerBodyItem.jsx
+++ b/react/FilePicker/FilePickerBodyItem.jsx
@@ -51,7 +51,7 @@ const FilePickerBodyItem = ({
const Input = multiple ? Checkbox : Radio
const listItemSecondaryContent = isFile(item)
- ? `${f(item.updated_at, 'DD MMM YYYY')} - ${filesize(item.size, {
+ ? `${f(item.updated_at, 'dd LLL yyyy')} - ${filesize(item.size, {
base: 10
})}`
: null
diff --git a/react/ListItem/ListItemFile/SecondaryText.jsx b/react/ListItem/ListItemFile/SecondaryText.jsx
index 1f736e8814..59c9184881 100644
--- a/react/ListItem/ListItemFile/SecondaryText.jsx
+++ b/react/ListItem/ListItemFile/SecondaryText.jsx
@@ -12,7 +12,7 @@ const SecondaryText = ({ secondary, file }) => {
if (secondary) return secondary
const date = file?.metadata?.datetime
- ? f(file?.metadata?.datetime, 'DD/MM/YYYY')
+ ? f(file?.metadata?.datetime, 'dd/LL/yyyy')
: null
return (
diff --git a/react/providers/I18n/format.jsx b/react/providers/I18n/format.jsx
index c6b3ba9a03..bb11a0f80c 100644
--- a/react/providers/I18n/format.jsx
+++ b/react/providers/I18n/format.jsx
@@ -1,5 +1,5 @@
-import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'
import format from 'date-fns/format'
+import formatDistanceToNow from 'date-fns/formatDistanceToNow'
import { DEFAULT_LANG } from '.'
@@ -29,10 +29,13 @@ export const provideDateFnsLocale = (userLang, defaultLang = DEFAULT_LANG) => {
export const initFormat =
(userLang, defaultLang = DEFAULT_LANG) =>
- (date, formatStr) => {
+ (date, formatStr, opts = {}) => {
const locale = provideDateFnsLocale(userLang, defaultLang)
- return format(date, formatStr, { locale })
+ const ensureDate = date && typeof date === 'string' ? new Date(date) : date
+
+ return format(ensureDate, formatStr, { locale, ...opts })
}
-export const formatLocallyDistanceToNow = date =>
- distanceInWordsToNow(date, { locale: locales[lang] })
+export const formatLocallyDistanceToNow = date => {
+ return formatDistanceToNow(date, { locale: locales[lang] })
+}
diff --git a/react/providers/I18n/index.spec.jsx b/react/providers/I18n/index.spec.jsx
index f46a52e886..9f53df5caf 100644
--- a/react/providers/I18n/index.spec.jsx
+++ b/react/providers/I18n/index.spec.jsx
@@ -10,7 +10,7 @@ const DumbI18nHelloWorld = ({ t, f, lang }) => (
{t('helloworld')}
- {f('2020-01-06', 'DDD MMM')}
+ {f('2020-01-06', 'D LLL', { useAdditionalDayOfYearTokens: true })}
{lang}
diff --git a/yarn.lock b/yarn.lock
index 39ca64c0cb..a6b91d5e4f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1403,6 +1403,13 @@
dependencies:
regenerator-runtime "^0.13.4"
+"@babel/runtime@^7.21.0":
+ version "7.26.0"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1"
+ integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==
+ dependencies:
+ regenerator-runtime "^0.14.0"
+
"@babel/runtime@^7.9.2":
version "7.14.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.6.tgz#535203bc0892efc7dec60bdc27b2ecf6e409062d"
@@ -6548,10 +6555,12 @@ date-fns@2.29.3:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==
-date-fns@^1.28.5:
- version "1.30.1"
- resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
- integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
+date-fns@2.30.0:
+ version "2.30.0"
+ resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
+ integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==
+ dependencies:
+ "@babel/runtime" "^7.21.0"
date-now@^0.1.4:
version "0.1.4"
@@ -16623,6 +16632,11 @@ regenerator-runtime@^0.13.4:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz#e96bf612a3362d12bb69f7e8f74ffeab25c7ac91"
integrity sha512-plpwicqEzfEyTQohIKktWigcLzmNStMGwbOUbykx51/29Z3JOGYldaaNGK7ngNXV+UcoqvIMmloZ48Sr74sd+g==
+regenerator-runtime@^0.14.0:
+ version "0.14.1"
+ resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f"
+ integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==
+
regenerator-transform@^0.14.2:
version "0.14.5"
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4"