There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat(server): display date in yyyy-MM-dd format on email (#10916)
fengmk24a3180ee0403
diff --git a/packages/backend/server/package.json b/packages/backend/server/package.jsonindex 632da0ca13..ad84c82d6b 100644--- a/packages/backend/server/package.json+++ b/packages/backend/server/package.json@@ -66,6 +66,7 @@"@socket.io/redis-adapter": "^8.3.0","bullmq": "^5.40.2","cookie-parser": "^1.4.7",+ "date-fns": "^4.0.0","dotenv": "^16.4.7","eventemitter2": "^6.4.9","eventsource-parser": "^3.0.0",diff --git a/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.md b/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.mdindex 171a78b8a4..88acddcff7 100644--- a/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.md+++ b/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.md@@ -1403,9 +1403,9 @@ Generated by [AVA](https://avajs.dev).>Test Workspace</span␊>␊team workspace expired on<!-- -->␊- <span style="font-weight:600">1/1/2025</span>. All workspace␊- data will be permanently deleted on<!-- -->␊- <span style="font-weight:600">1/31/2025</span> (180 days after␊+ <span style="font-weight:600">2025-01-01</span>. All workspace␊+ data will be permanently deleted on␊+ <span style="font-weight:600">2025-01-31</span> (180 days after␊expiration). To prevent data loss, please either:␊<li>␊<span␊@@ -1510,8 +1510,8 @@ Generated by [AVA](https://avajs.dev).style="font-weight:600"␊>Test Workspace</span␊>␊- team workspace data will be permanently deleted in 24 hours on<!-- -->␊- <span style="font-weight:600">1/31/2025</span>. To prevent data␊+ team workspace data will be permanently deleted in 24 hours on␊+ <span style="font-weight:600">2025-01-31</span>. To prevent data␊loss, please take immediate action:␊<li>␊<span␊@@ -1775,10 +1775,10 @@ Generated by [AVA](https://avajs.dev).>Test Workspace</span␊>␊team workspace will expire on<!-- -->␊- <span style="font-weight:600">1/1/2025</span>. After expiration,␊- you won't be able to sync or collaborate with team members.␊- Please renew your subscription to continue using all team␊- features.␊+ <span style="font-weight:600">2025-01-01</span>. After␊+ expiration, you won't be able to sync or collaborate with␊+ team members. Please renew your subscription to continue using␊+ all team features.␊</p>␊</tr>␊</tbody>␊@@ -1870,7 +1870,7 @@ Generated by [AVA](https://avajs.dev).>Test Workspace</span␊>␊team workspace expired on<!-- -->␊- <span style="font-weight:600">1/1/2025</span>. Your workspace␊+ <span style="font-weight:600">2025-01-01</span>. Your workspace␊can't sync or collaborate with team members. Please renew␊your subscription to restore all team features.␊</p>␊diff --git a/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.snap b/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.snapindex de44f7bd0e..d6bbe8967f 100644Binary files a/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.snap and b/packages/backend/server/src/__tests__/__snapshots__/mailer.spec.ts.snap differdiff --git a/packages/backend/server/src/mails/components/date.tsx b/packages/backend/server/src/mails/components/date.tsxnew file mode 100644index 0000000000..df24dc2955--- /dev/null+++ b/packages/backend/server/src/mails/components/date.tsx@@ -0,0 +1,11 @@+import { format } from 'date-fns';++import { Bold } from './template';++export interface DateProps {+ value: Date;+}++export const IOSDate = (props: DateProps) => {+ return <Bold>{format(props.value, 'yyyy-MM-dd')}</Bold>;+};diff --git a/packages/backend/server/src/mails/components/index.ts b/packages/backend/server/src/mails/components/index.tsindex cc33e38512..bacdecaca3 100644--- a/packages/backend/server/src/mails/components/index.ts+++ b/packages/backend/server/src/mails/components/index.ts@@ -1,3 +1,4 @@+export * from './date';export * from './template';export * from './user';export * from './workspace';diff --git a/packages/backend/server/src/mails/teams/delete-in-1m.tsx b/packages/backend/server/src/mails/teams/delete-in-1m.tsxindex cadd1b9a28..545e294954 100644--- a/packages/backend/server/src/mails/teams/delete-in-1m.tsx+++ b/packages/backend/server/src/mails/teams/delete-in-1m.tsx@@ -1,8 +1,8 @@import { TEST_WORKSPACE } from '../common';import {- Bold,Button,Content,+ IOSDate,P,Template,Text,@@ -27,10 +27,9 @@ export default function TeamDeleteInOneMonth(props: TeamDeleteInOneMonthProps) {<Content><P>Your <Workspace {...workspace} /> team workspace expired on{' '}- <Bold>{expirationDate.toLocaleDateString()}</Bold>. All workspace data- will be permanently deleted on{' '}- <Bold>{deletionDate.toLocaleDateString()}</Bold> (180 days after- expiration). To prevent data loss, please either:+ <IOSDate value={expirationDate} />. All workspace data will be+ permanently deleted on <IOSDate value={deletionDate} /> (180 days+ after expiration). To prevent data loss, please either:<li><Text>Renew your subscription to restore team features</Text></li>diff --git a/packages/backend/server/src/mails/teams/delete-in-24h.tsx b/packages/backend/server/src/mails/teams/delete-in-24h.tsxindex 2ab6940f57..8a9f59deba 100644--- a/packages/backend/server/src/mails/teams/delete-in-24h.tsx+++ b/packages/backend/server/src/mails/teams/delete-in-24h.tsx@@ -1,8 +1,8 @@import { TEST_WORKSPACE } from '../common';import {- Bold,Button,Content,+ IOSDate,P,Template,Text,@@ -26,9 +26,8 @@ export default function TeamDeleteIn24Hours(props: TeamDeleteIn24HoursProps) {<Content><P>Your <Workspace {...workspace} /> team workspace data will be- permanently deleted in 24 hours on{' '}- <Bold>{deletionDate.toLocaleDateString()}</Bold>. To prevent data- loss, please take immediate action:+ permanently deleted in 24 hours on <IOSDate value={deletionDate} />.+ To prevent data loss, please take immediate action:<li><Text>Renew your subscription to restore team features</Text></li>diff --git a/packages/backend/server/src/mails/teams/expire-soon.tsx b/packages/backend/server/src/mails/teams/expire-soon.tsxindex c7d950a68a..190160471b 100644--- a/packages/backend/server/src/mails/teams/expire-soon.tsx+++ b/packages/backend/server/src/mails/teams/expire-soon.tsx@@ -1,8 +1,8 @@import { TEST_WORKSPACE } from '../common';import {- Bold,Button,Content,+ IOSDate,P,Template,Title,@@ -25,9 +25,9 @@ export default function TeamExpireSoon(props: TeamExpireSoonProps) {<Content><P>Your <Workspace {...workspace} /> team workspace will expire on{' '}- <Bold>{expirationDate.toLocaleDateString()}</Bold>. After expiration,- you won't be able to sync or collaborate with team members.- Please renew your subscription to continue using all team features.+ <IOSDate value={expirationDate} />. After expiration, you won't+ be able to sync or collaborate with team members. Please renew your+ subscription to continue using all team features.</P><Button href={url}>Go to Billing</Button></Content>diff --git a/packages/backend/server/src/mails/teams/expired.tsx b/packages/backend/server/src/mails/teams/expired.tsxindex 60088fd824..036823a957 100644--- a/packages/backend/server/src/mails/teams/expired.tsx+++ b/packages/backend/server/src/mails/teams/expired.tsx@@ -1,8 +1,8 @@import { TEST_WORKSPACE } from '../common';import {- Bold,Button,Content,+ IOSDate,P,Template,Title,@@ -25,9 +25,9 @@ export default function TeamExpired(props: TeamExpiredProps) {<Content><P>Your <Workspace {...workspace} /> team workspace expired on{' '}- <Bold>{expirationDate.toLocaleDateString()}</Bold>. Your workspace- can't sync or collaborate with team members. Please renew your- subscription to restore all team features.+ <IOSDate value={expirationDate} />. Your workspace can't sync or+ collaborate with team members. Please renew your subscription to+ restore all team features.</P><Button href={url}>Go to Billing</Button></Content>diff --git a/yarn.lock b/yarn.lockindex 4ae42262d5..aec8ceeb57 100644--- a/yarn.lock+++ b/yarn.lock@@ -905,6 +905,7 @@ __metadata:c8: "npm:^10.1.3"cookie-parser: "npm:^1.4.7"cross-env: "npm:^7.0.3"+ date-fns: "npm:^4.0.0"dotenv: "npm:^16.4.7"eventemitter2: "npm:^6.4.9"eventsource-parser: "npm:^3.0.0"