diff --git a/app/scenes/Document/components/Notices.tsx b/app/scenes/Document/components/Notices.tsx index 6bb79c9ed..a076e597b 100644 --- a/app/scenes/Document/components/Notices.tsx +++ b/app/scenes/Document/components/Notices.tsx @@ -1,4 +1,4 @@ -import differenceInDays from "date-fns/differenceInDays"; +import { differenceInDays } from "date-fns"; import { TrashIcon, ArchiveIcon, ShapesIcon, InputIcon } from "outline-icons"; import * as React from "react"; import { Trans, useTranslation } from "react-i18next"; diff --git a/package.json b/package.json index 6dfb1a927..d0b3547e0 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "core-js": "^3.36.0", "crypto-js": "^4.2.0", "datadog-metrics": "^0.11.1", - "date-fns": "^2.30.0", + "date-fns": "^3.6.0", "dd-trace": "^3.51.0", "diff": "^5.2.0", "dotenv": "^16.4.5", @@ -319,7 +319,7 @@ "babel-plugin-transform-typescript-metadata": "^0.3.2", "babel-plugin-tsconfig-paths-module-resolver": "^1.0.4", "browserslist-to-esbuild": "^1.2.0", - "concurrently": "^7.6.0", + "concurrently": "^8.2.2", "eslint": "^8.47.0", "eslint-config-prettier": "^8.10.0", "eslint-import-resolver-typescript": "^3.6.1", @@ -353,6 +353,7 @@ "d3": "^7.0.0", "debug": "4.3.4", "node-fetch": "^2.6.12", + "date-fns": "^3.6.0", "dot-prop": "^5.2.0", "js-yaml": "^3.14.1", "jpeg-js": "0.4.4", diff --git a/server/queues/tasks/InviteReminderTask.test.ts b/server/queues/tasks/InviteReminderTask.test.ts index 313e52004..c1a3c15e7 100644 --- a/server/queues/tasks/InviteReminderTask.test.ts +++ b/server/queues/tasks/InviteReminderTask.test.ts @@ -1,4 +1,4 @@ -import { subDays } from "date-fns"; +import { subHours } from "date-fns"; import InviteReminderEmail from "@server/emails/templates/InviteReminderEmail"; import { buildInvite } from "@server/test/factories"; import InviteReminderTask from "./InviteReminderTask"; @@ -9,7 +9,7 @@ describe("InviteReminderTask", () => { // too old await buildInvite({ - createdAt: subDays(new Date(), 3.5), + createdAt: subHours(new Date(), 84), }); // too new @@ -19,7 +19,7 @@ describe("InviteReminderTask", () => { // should send reminder await buildInvite({ - createdAt: subDays(new Date(), 2.5), + createdAt: subHours(new Date(), 60), }); const task = new InviteReminderTask(); diff --git a/server/routes/index.ts b/server/routes/index.ts index 5b5245bbb..50b0f1011 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -1,6 +1,6 @@ import crypto from "crypto"; import path from "path"; -import formatRFC7231 from "date-fns/formatRFC7231"; +import { formatRFC7231 } from "date-fns"; import Koa, { BaseContext } from "koa"; import compress from "koa-compress"; import Router from "koa-router"; diff --git a/shared/utils/date.ts b/shared/utils/date.ts index e6a5e0ec3..d0d73b87c 100644 --- a/shared/utils/date.ts +++ b/shared/utils/date.ts @@ -1,5 +1,6 @@ /* eslint-disable import/no-duplicates */ import { + Locale, addSeconds, formatDistanceToNow, subDays, diff --git a/yarn.lock b/yarn.lock index e876a8fff..62b991030 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1047,7 +1047,7 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity "sha1-8LppsHXh8F+yglt/rZkeetuxgxA= sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.8", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.8", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.6.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.24.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.4.tgz#de795accd698007a66ba44add6cc86542aff1edd" integrity sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA== @@ -5263,20 +5263,20 @@ concat-stream@~2.0.0: readable-stream "^3.0.2" typedarray "^0.0.6" -concurrently@^7.6.0: - version "7.6.0" - resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.6.0.tgz#531a6f5f30cf616f355a4afb8f8fcb2bba65a49a" - integrity "sha1-UxpvXzDPYW81Wkr7j4/LK7plpJo= sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==" +concurrently@^8.2.2: + version "8.2.2" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-8.2.2.tgz#353141985c198cfa5e4a3ef90082c336b5851784" + integrity sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg== dependencies: - chalk "^4.1.0" - date-fns "^2.29.1" + chalk "^4.1.2" + date-fns "^2.30.0" lodash "^4.17.21" - rxjs "^7.0.0" - shell-quote "^1.7.3" - spawn-command "^0.0.2-1" - supports-color "^8.1.0" + rxjs "^7.8.1" + shell-quote "^1.8.1" + spawn-command "0.0.2" + supports-color "^8.1.1" tree-kill "^1.2.2" - yargs "^17.3.1" + yargs "^17.7.2" condense-newlines@^0.2.1: version "0.2.1" @@ -5872,12 +5872,10 @@ datadog-metrics@^0.11.1: "@datadog/datadog-api-client" "^1.16.0" debug "^4.1.0" -date-fns@^2.28.0, date-fns@^2.29.1, date-fns@^2.30.0: - version "2.30.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0" - integrity "sha1-82fmRIOf9XiU7GrEgN5AyuSw9NA= sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==" - dependencies: - "@babel/runtime" "^7.21.0" +date-fns@^2.28.0, date-fns@^2.30.0, date-fns@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.6.0.tgz#f20ca4fe94f8b754951b24240676e8618c0206bf" + integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww== dc-polyfill@^0.1.4: version "0.1.4" @@ -12030,10 +12028,10 @@ rw@1: resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" integrity "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q= sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" -rxjs@^7.0.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" - integrity "sha1-kKk4hiqCiI/0xzWYEaWV4U4eCaQ= sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==" +rxjs@^7.8.1: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== dependencies: tslib "^2.1.0" @@ -12266,7 +12264,7 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI= sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" -shell-quote@^1.7.3, shell-quote@^1.8.1: +shell-quote@^1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== @@ -12475,10 +12473,10 @@ space-separated-tokens@^1.0.0: resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz#85f32c3d10d9682007e917414ddc5c26d1aa6899" integrity "sha1-hfMsPRDZaCAH6RdBTdxcJtGqaJk= sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==" -spawn-command@^0.0.2-1: - version "0.0.2-1" - resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" - integrity "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A= sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==" +spawn-command@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e" + integrity sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ== split-on-first@^1.0.0: version "1.1.0" @@ -12774,7 +12772,7 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0, supports-color@^8.1.0: +supports-color@^8.0.0, supports-color@^8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw= sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==" @@ -14108,7 +14106,7 @@ yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity "sha1-kJa87r+ZDSG7MfqVFuDt4pSnfTU= sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" -yargs@17.7.2, yargs@^17.3.1: +yargs@17.7.2, yargs@^17.3.1, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity "sha1-mR3zmspnWhkrgW4eA2P5110qomk= sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="