- {t('format:longDateTime', {
+ {t(`format:${getDateFormat(createdAt)}`, {
postProcess: 'formatDate',
value: createdAt,
})}
diff --git a/client/src/components/CardModal/Activities/ItemComment.jsx b/client/src/components/CardModal/Activities/ItemComment.jsx
index 488f0d8..fca47b3 100755
--- a/client/src/components/CardModal/Activities/ItemComment.jsx
+++ b/client/src/components/CardModal/Activities/ItemComment.jsx
@@ -6,6 +6,7 @@ import { Comment } from 'semantic-ui-react';
import { usePopup } from '../../../lib/popup';
import { Markdown } from '../../../lib/custom-ui';
+import getDateFormat from '../../../utils/get-date-format';
import CommentEdit from './CommentEdit';
import User from '../../User';
import DeleteStep from '../../DeleteStep';
@@ -33,7 +34,7 @@ const ItemComment = React.memo(
{user.name}
- {t('format:longDateTime', {
+ {t(`format:${getDateFormat(createdAt)}`, {
postProcess: 'formatDate',
value: createdAt,
})}
diff --git a/client/src/components/DueDate/DueDate.jsx b/client/src/components/DueDate/DueDate.jsx
index e36fa25..59f0754 100644
--- a/client/src/components/DueDate/DueDate.jsx
+++ b/client/src/components/DueDate/DueDate.jsx
@@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import { useTranslation } from 'react-i18next';
+import getDateFormat from '../../utils/get-date-format';
+
import styles from './DueDate.module.scss';
const SIZES = {
@@ -12,15 +14,27 @@ const SIZES = {
MEDIUM: 'medium',
};
-const FORMATS = {
+const LONG_DATE_FORMAT_BY_SIZE = {
tiny: 'longDate',
small: 'longDate',
medium: 'longDateTime',
};
+const FULL_DATE_FORMAT_BY_SIZE = {
+ tiny: 'fullDate',
+ small: 'fullDate',
+ medium: 'fullDateTime',
+};
+
const DueDate = React.memo(({ value, size, isDisabled, onClick }) => {
const [t] = useTranslation();
+ const dateFormat = getDateFormat(
+ value,
+ LONG_DATE_FORMAT_BY_SIZE[size],
+ FULL_DATE_FORMAT_BY_SIZE[size],
+ );
+
const contentNode = (
{
onClick && styles.wrapperHoverable,
)}
>
- {t(`format:${FORMATS[size]}`, {
+ {t(`format:${dateFormat}`, {
value,
postProcess: 'formatDate',
})}
diff --git a/client/src/locales/cs/core.js b/client/src/locales/cs/core.js
index f32a580..04dfc8d 100644
--- a/client/src/locales/cs/core.js
+++ b/client/src/locales/cs/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd MMM',
longDateTime: "d MMMM 'v' p",
+ fullDate: 'd MMM, y',
+ fullDateTime: "d MMMM, y 'v' p",
},
translation: {
diff --git a/client/src/locales/da/core.js b/client/src/locales/da/core.js
index 7793d4e..93e7096 100644
--- a/client/src/locales/da/core.js
+++ b/client/src/locales/da/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'at' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'a' p",
},
translation: {
diff --git a/client/src/locales/de/core.js b/client/src/locales/de/core.js
index 4389df0..0b743de 100644
--- a/client/src/locales/de/core.js
+++ b/client/src/locales/de/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd. MMM',
longDateTime: "d. MMMM 'um' p",
+ fullDate: 'd. MMM. y',
+ fullDateTime: "d. MMMM. y 'um' p",
},
translation: {
diff --git a/client/src/locales/en/core.js b/client/src/locales/en/core.js
index 10c40a6..83b0116 100644
--- a/client/src/locales/en/core.js
+++ b/client/src/locales/en/core.js
@@ -5,6 +5,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'at' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'at' p",
},
translation: {
diff --git a/client/src/locales/es/core.js b/client/src/locales/es/core.js
index e7e2d8d..a0b1260 100644
--- a/client/src/locales/es/core.js
+++ b/client/src/locales/es/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'a' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'a' p",
},
translation: {
diff --git a/client/src/locales/fr/core.js b/client/src/locales/fr/core.js
index 81f43cb..e20e291 100644
--- a/client/src/locales/fr/core.js
+++ b/client/src/locales/fr/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd MMM',
longDateTime: "d MMMM 'à' p",
+ fullDate: 'd MMM y',
+ fullDateTime: "d MMMM y 'à' p",
},
translation: {
diff --git a/client/src/locales/it/core.js b/client/src/locales/it/core.js
index 0241da6..f08a946 100644
--- a/client/src/locales/it/core.js
+++ b/client/src/locales/it/core.js
@@ -5,6 +5,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'at' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'at' p",
},
translation: {
diff --git a/client/src/locales/ja/core.js b/client/src/locales/ja/core.js
index 56a1776..8242246 100644
--- a/client/src/locales/ja/core.js
+++ b/client/src/locales/ja/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMMMd日',
longDateTime: "MMMMd'日 ' HH:mm",
+ fullDate: 'yyyy年M月d日',
+ fullDateTime: 'yyyy年M月d日 HH:mm',
},
translation: {
diff --git a/client/src/locales/ko/core.js b/client/src/locales/ko/core.js
index 834c8d3..474f9de 100644
--- a/client/src/locales/ko/core.js
+++ b/client/src/locales/ko/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: "MMMMd'일'",
longDateTime: "MMMMd'일 ' a hh시 mm분",
+ fullDate: 'yyyy년M월d일',
+ fullDateTime: 'yyyy년M월d일 a hh시 mm분',
},
translation: {
diff --git a/client/src/locales/pl/core.js b/client/src/locales/pl/core.js
index 0acc266..54ac306 100644
--- a/client/src/locales/pl/core.js
+++ b/client/src/locales/pl/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd MMM',
longDateTime: "d MMMM 'o' p",
+ fullDate: 'd MMM y',
+ fullDateTime: "d MMMM y 'o' p",
},
translation: {
diff --git a/client/src/locales/ro/core.js b/client/src/locales/ro/core.js
index c9b9e9d..2e19922 100644
--- a/client/src/locales/ro/core.js
+++ b/client/src/locales/ro/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd MMM',
longDateTime: "d MMMM 'в' p",
+ fullDate: 'd MMM y',
+ fullDateTime: "d MMMM y 'в' p",
},
translation: {
diff --git a/client/src/locales/ru/core.js b/client/src/locales/ru/core.js
index 1937103..138b893 100644
--- a/client/src/locales/ru/core.js
+++ b/client/src/locales/ru/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd MMM',
longDateTime: "d MMMM 'в' p",
+ fullDate: 'd MMM y',
+ fullDateTime: "d MMMM y 'в' p",
},
translation: {
diff --git a/client/src/locales/sk/core.js b/client/src/locales/sk/core.js
index 574be43..b371630 100644
--- a/client/src/locales/sk/core.js
+++ b/client/src/locales/sk/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd MMM',
longDateTime: "d MMMM 'v' p",
+ fullDate: 'd MMM y',
+ fullDateTime: "d MMMM y 'v' p",
},
translation: {
diff --git a/client/src/locales/sv/core.js b/client/src/locales/sv/core.js
index 1b43e13..0f7b37f 100644
--- a/client/src/locales/sv/core.js
+++ b/client/src/locales/sv/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'at' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'at' p",
},
translation: {
diff --git a/client/src/locales/tr/core.js b/client/src/locales/tr/core.js
index bd267c0..b04cd21 100644
--- a/client/src/locales/tr/core.js
+++ b/client/src/locales/tr/core.js
@@ -9,6 +9,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'd. MMM',
longDateTime: "d. MMMM 'Saat' p",
+ fullDate: 'd. MMM. y',
+ fullDateTime: "d. MMMM. y 'Saat' p",
},
translation: {
diff --git a/client/src/locales/uz/core.js b/client/src/locales/uz/core.js
index cc2c52e..084de78 100644
--- a/client/src/locales/uz/core.js
+++ b/client/src/locales/uz/core.js
@@ -5,6 +5,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'at' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'at' p",
},
translation: {
diff --git a/client/src/locales/zh/core.js b/client/src/locales/zh/core.js
index c381a88..643bb4e 100644
--- a/client/src/locales/zh/core.js
+++ b/client/src/locales/zh/core.js
@@ -5,6 +5,8 @@ export default {
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "MMMM d 'at' p",
+ fullDate: 'MMM d, y',
+ fullDateTime: "MMMM d, y 'at' p",
},
translation: {
diff --git a/client/src/utils/get-date-format.js b/client/src/utils/get-date-format.js
new file mode 100644
index 0000000..cb7525d
--- /dev/null
+++ b/client/src/utils/get-date-format.js
@@ -0,0 +1,6 @@
+export default (value, longDateFormat = 'longDateTime', fullDateFormat = 'fullDateTime') => {
+ const year = value.getFullYear();
+ const currentYear = new Date().getFullYear();
+
+ return year === currentYear ? longDateFormat : fullDateFormat;
+};