@chayns-components/date 5.0.0-beta.885 → 5.0.0-beta.887

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,7 @@ const useDateInfo = ({
20
20
  const [formattedDateString, setFormattedDateString] = (0, _react.useState)('');
21
21
  const [language] = (0, _react.useState)((0, _dateInfo.getLanguage)());
22
22
  const formattedDate = (0, _react.useMemo)(() => new Date(date), [date]);
23
+ const isDateNearToday = (0, _dateFns.isToday)(date) || (0, _dateFns.isYesterday)(date) || (0, _dateFns.isTomorrow)(date);
23
24
  (0, _react.useEffect)(() => {
24
25
  // This useEffect is used for normal date formation
25
26
  if (shouldShowDateToNowDifference) {
@@ -32,24 +33,28 @@ const useDateInfo = ({
32
33
  date: formattedDate,
33
34
  language
34
35
  });
35
- let formatString = 'dd. ';
36
- formatString += `${(0, _dateInfo.getMonthFormat)({
37
- shouldUseShortText
38
- })}`;
39
- formatString += `${(0, _dateInfo.getYearFormat)({
40
- date: formattedDate,
41
- shouldShowYear
42
- })}`;
43
- newFormattedDateString += (0, _dateFns.format)(formattedDate, formatString, {
44
- locale: language
45
- });
36
+ if (!isDateNearToday || !shouldShowRelativeDayOfWeek || !shouldShowTime) {
37
+ let formatString = 'dd. ';
38
+ formatString += `${(0, _dateInfo.getMonthFormat)({
39
+ shouldUseShortText
40
+ })}`;
41
+ formatString += `${(0, _dateInfo.getYearFormat)({
42
+ date: formattedDate,
43
+ shouldShowYear
44
+ })}`;
45
+ newFormattedDateString += (0, _dateFns.format)(formattedDate, formatString, {
46
+ locale: language
47
+ });
48
+ } else {
49
+ newFormattedDateString = newFormattedDateString.replace(', ', '');
50
+ }
46
51
  newFormattedDateString += (0, _dateInfo.getFormattedTime)({
47
52
  date: formattedDate,
48
53
  shouldShowTime,
49
54
  language
50
55
  });
51
56
  setFormattedDateString(newFormattedDateString);
52
- }, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowYear, shouldShowTime, shouldUseShortText]);
57
+ }, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowYear, shouldShowTime, shouldUseShortText, isDateNearToday]);
53
58
 
54
59
  // Calculate remaining time till next minute to update time according to time left
55
60
  const [currentDate, setCurrentDate] = (0, _react.useState)(new Date());
@@ -1 +1 @@
1
- {"version":3,"file":"useDateInfo.js","names":["_dateFns","require","_react","_dateInfo","useDateInfo","date","shouldShowDateToNowDifference","shouldShowRelativeDayOfWeek","shouldShowDayOfWeek","shouldShowTime","shouldUseShortText","shouldShowYear","preText","formattedDateString","setFormattedDateString","useState","language","getLanguage","formattedDate","useMemo","Date","useEffect","newFormattedDateString","getFormattedDayOfWeek","formatString","getMonthFormat","getYearFormat","format","locale","getFormattedTime","currentDate","setCurrentDate","timeoutTime","getSeconds","timeDiffInMs","getTime","isPast","Math","max","timeout","setTimeout","clearTimeout","getTimeTillNow","trim","exports"],"sources":["../../../src/hooks/useDateInfo.ts"],"sourcesContent":["import { format, isPast } from 'date-fns';\nimport { useEffect, useMemo, useState } from 'react';\nimport {\n getFormattedDayOfWeek,\n getFormattedTime,\n getLanguage,\n getMonthFormat,\n getTimeTillNow,\n getYearFormat,\n} from '../utils/dateInfo';\n\nexport interface UseDateInfoOptions {\n /**\n * The date, that should be displayed\n */\n date: Date | string;\n /**\n * Additional text for \"shouldShowDateToNowDifference\" prop. Writes a text before the calculated time\n */\n preText?: string;\n /**\n * Adds the current year to the display\n */\n shouldShowYear?: boolean;\n /**\n * Adds the time to the display.\n */\n shouldShowTime?: boolean;\n /**\n * Whether the relative day of week to today should be shown (today, yesterday or tomorrow).\n */\n shouldShowRelativeDayOfWeek?: boolean;\n /**\n * Shortens the day and month text to maximum three digits\n */\n shouldUseShortText?: boolean;\n /**\n * Adds the day of week to the display\n */\n shouldShowDayOfWeek?: boolean;\n /**\n * Shows the difference from the date to now. The component handles updates itself.\n */\n shouldShowDateToNowDifference?: boolean;\n}\n\nexport const useDateInfo = ({\n date,\n shouldShowDateToNowDifference,\n shouldShowRelativeDayOfWeek,\n shouldShowDayOfWeek,\n shouldShowTime,\n shouldUseShortText,\n shouldShowYear,\n preText,\n}: UseDateInfoOptions) => {\n const [formattedDateString, setFormattedDateString] = useState<string>('');\n const [language] = useState(getLanguage());\n\n const formattedDate = useMemo(() => new Date(date), [date]);\n\n useEffect(() => {\n // This useEffect is used for normal date formation\n if (shouldShowDateToNowDifference) {\n return;\n }\n\n let newFormattedDateString = getFormattedDayOfWeek({\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n date: formattedDate,\n language,\n });\n\n let formatString = 'dd. ';\n\n formatString += `${getMonthFormat({ shouldUseShortText })}`;\n\n formatString += `${getYearFormat({\n date: formattedDate,\n shouldShowYear,\n })}`;\n\n newFormattedDateString += format(formattedDate, formatString, { locale: language });\n\n newFormattedDateString += getFormattedTime({\n date: formattedDate,\n shouldShowTime,\n language,\n });\n\n setFormattedDateString(newFormattedDateString);\n }, [\n date,\n formattedDate,\n language,\n shouldShowDateToNowDifference,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowYear,\n shouldShowTime,\n shouldUseShortText,\n ]);\n\n // Calculate remaining time till next minute to update time according to time left\n const [currentDate, setCurrentDate] = useState(new Date());\n\n useEffect(() => {\n // This useEffect is for calculating the current date for shouldShowDateToNowDifference option\n if (!shouldShowDateToNowDifference) {\n return () => {};\n }\n\n let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();\n\n // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently\n if (timeoutTime < 0) {\n timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();\n }\n\n // initialized with remaining time\n let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();\n\n // set to elapsed time\n if (isPast(formattedDate)) {\n timeDiffInMs = currentDate.getTime() - formattedDate.getTime();\n }\n\n // time difference is less than a minute, time should be updated every second\n if (timeDiffInMs < 60000) {\n timeoutTime = 1;\n }\n\n // Set timeoutTime to at least 1000ms\n timeoutTime = Math.max(timeoutTime * 1000, 1000);\n\n const timeout = setTimeout(() => {\n setCurrentDate(new Date());\n }, timeoutTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n // This useEffect is for showing the difference of the date to now\n if (shouldShowDateToNowDifference) {\n setFormattedDateString(getTimeTillNow({ date: formattedDate, currentDate, language }));\n }\n }, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);\n\n return useMemo(\n () => `${preText ? `${preText.trim()} ` : ''}${formattedDateString}`,\n [formattedDateString, preText],\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AA4CO,MAAMG,WAAW,GAAGA,CAAC;EACxBC,IAAI;EACJC,6BAA6B;EAC7BC,2BAA2B;EAC3BC,mBAAmB;EACnBC,cAAc;EACdC,kBAAkB;EAClBC,cAAc;EACdC;AACgB,CAAC,KAAK;EACtB,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAG,IAAAC,eAAQ,EAAS,EAAE,CAAC;EAC1E,MAAM,CAACC,QAAQ,CAAC,GAAG,IAAAD,eAAQ,EAAC,IAAAE,qBAAW,EAAC,CAAC,CAAC;EAE1C,MAAMC,aAAa,GAAG,IAAAC,cAAO,EAAC,MAAM,IAAIC,IAAI,CAACf,IAAI,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAE3D,IAAAgB,gBAAS,EAAC,MAAM;IACZ;IACA,IAAIf,6BAA6B,EAAE;MAC/B;IACJ;IAEA,IAAIgB,sBAAsB,GAAG,IAAAC,+BAAqB,EAAC;MAC/Cf,mBAAmB;MACnBD,2BAA2B;MAC3BG,kBAAkB;MAClBL,IAAI,EAAEa,aAAa;MACn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K,OAAO,CAAC,CAAC;;IAElE;IACA,IAAI,IAAAC,eAAM,EAAClB,aAAa,CAAC,EAAE;MACvBgB,YAAY,GAAGJ,WAAW,CAACK,OAAO,CAAC,CAAC,GAAGjB,aAAa,CAACiB,OAAO,CAAC,CAAC;IAClE;;IAEA;IACA,IAAID,YAAY,GAAG,KAAK,EAAE;MACtBF,WAAW,GAAG,CAAC;IACnB;;IAEA;IACAA,WAAW,GAAGK,IAAI,CAACC,GAAG,CAACN,WAAW,GAAG,IAAI,EAAE,IAAI,CAAC;IAEhD,MAAMO,OAAO,GAAGC,UAAU,CAAC,MAAM;MAC7BT,cAAc,CAAC,IAAIX,IAAI,CAAC,CAAC,CAAC;IAC9B,CAAC,EAAEY,WAAW,CAAC;IAEf,OAAO,MAAM;MACTS,YAAY,CAACF,OAAO,CAAC;IACzB,CAAC;EACL,CAAC,EAAE,CAACT,WAAW,EAAEzB,IAAI,EAAEa,aAAa,EAAEZ,6BAA6B,CAAC,CAAC;EAErE,IAAAe,gBAAS,EAAC,MAAM;IACZ;IACA,IAAIf,6BAA6B,EAAE;MAC/BQ,sBAAsB,CAAC,IAAA4B,wBAAc,EAAC;QAAErC,IAAI,EAAEa,aAAa;QAAEY,WAAW;QAAEd;MAAS,CAAC,CAAC,CAAC;IAC1F;EACJ,CAAC,EAAE,CAACc,WAAW,EAAEzB,IAAI,EAAEa,aAAa,EAAEF,QAAQ,EAAEV,6BAA6B,CAAC,CAAC;EAE/E,OAAO,IAAAa,cAAO,EACV,MAAM,GAAGP,OAAO,GAAG,GAAGA,OAAO,CAAC+B,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG9B,mBAAmB,EAAE,EACpE,CAACA,mBAAmB,EAAED,OAAO,CACjC,CAAC;AACL,CAAC;AAACgC,OAAA,CAAAxC,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"useDateInfo.js","names":["_dateFns","require","_react","_dateInfo","useDateInfo","date","shouldShowDateToNowDifference","shouldShowRelativeDayOfWeek","shouldShowDayOfWeek","shouldShowTime","shouldUseShortText","shouldShowYear","preText","formattedDateString","setFormattedDateString","useState","language","getLanguage","formattedDate","useMemo","Date","isDateNearToday","isToday","isYesterday","isTomorrow","useEffect","newFormattedDateString","getFormattedDayOfWeek","formatString","getMonthFormat","getYearFormat","format","locale","replace","getFormattedTime","currentDate","setCurrentDate","timeoutTime","getSeconds","timeDiffInMs","getTime","isPast","Math","max","timeout","setTimeout","clearTimeout","getTimeTillNow","trim","exports"],"sources":["../../../src/hooks/useDateInfo.ts"],"sourcesContent":["import { format, isPast, isToday, isTomorrow, isYesterday } from 'date-fns';\nimport { useEffect, useMemo, useState } from 'react';\nimport {\n getFormattedDayOfWeek,\n getFormattedTime,\n getLanguage,\n getMonthFormat,\n getTimeTillNow,\n getYearFormat,\n} from '../utils/dateInfo';\n\nexport interface UseDateInfoOptions {\n /**\n * The date, that should be displayed\n */\n date: Date | string;\n /**\n * Additional text for \"shouldShowDateToNowDifference\" prop. Writes a text before the calculated time\n */\n preText?: string;\n /**\n * Adds the current year to the display\n */\n shouldShowYear?: boolean;\n /**\n * Adds the time to the display.\n */\n shouldShowTime?: boolean;\n /**\n * Whether the relative day of week to today should be shown (today, yesterday or tomorrow).\n */\n shouldShowRelativeDayOfWeek?: boolean;\n /**\n * Shortens the day and month text to maximum three digits\n */\n shouldUseShortText?: boolean;\n /**\n * Adds the day of week to the display\n */\n shouldShowDayOfWeek?: boolean;\n /**\n * Shows the difference from the date to now. The component handles updates itself.\n */\n shouldShowDateToNowDifference?: boolean;\n}\n\nexport const useDateInfo = ({\n date,\n shouldShowDateToNowDifference,\n shouldShowRelativeDayOfWeek,\n shouldShowDayOfWeek,\n shouldShowTime,\n shouldUseShortText,\n shouldShowYear,\n preText,\n}: UseDateInfoOptions) => {\n const [formattedDateString, setFormattedDateString] = useState<string>('');\n const [language] = useState(getLanguage());\n\n const formattedDate = useMemo(() => new Date(date), [date]);\n\n const isDateNearToday = isToday(date) || isYesterday(date) || isTomorrow(date);\n\n useEffect(() => {\n // This useEffect is used for normal date formation\n if (shouldShowDateToNowDifference) {\n return;\n }\n\n let newFormattedDateString = getFormattedDayOfWeek({\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n date: formattedDate,\n language,\n });\n\n if (!isDateNearToday || !shouldShowRelativeDayOfWeek || !shouldShowTime) {\n let formatString = 'dd. ';\n\n formatString += `${getMonthFormat({ shouldUseShortText })}`;\n\n formatString += `${getYearFormat({\n date: formattedDate,\n shouldShowYear,\n })}`;\n\n newFormattedDateString += format(formattedDate, formatString, { locale: language });\n } else {\n newFormattedDateString = newFormattedDateString.replace(', ', '');\n }\n\n newFormattedDateString += getFormattedTime({\n date: formattedDate,\n shouldShowTime,\n language,\n });\n\n setFormattedDateString(newFormattedDateString);\n }, [\n date,\n formattedDate,\n language,\n shouldShowDateToNowDifference,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowYear,\n shouldShowTime,\n shouldUseShortText,\n isDateNearToday,\n ]);\n\n // Calculate remaining time till next minute to update time according to time left\n const [currentDate, setCurrentDate] = useState(new Date());\n\n useEffect(() => {\n // This useEffect is for calculating the current date for shouldShowDateToNowDifference option\n if (!shouldShowDateToNowDifference) {\n return () => {};\n }\n\n let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();\n\n // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently\n if (timeoutTime < 0) {\n timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();\n }\n\n // initialized with remaining time\n let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();\n\n // set to elapsed time\n if (isPast(formattedDate)) {\n timeDiffInMs = currentDate.getTime() - formattedDate.getTime();\n }\n\n // time difference is less than a minute, time should be updated every second\n if (timeDiffInMs < 60000) {\n timeoutTime = 1;\n }\n\n // Set timeoutTime to at least 1000ms\n timeoutTime = Math.max(timeoutTime * 1000, 1000);\n\n const timeout = setTimeout(() => {\n setCurrentDate(new Date());\n }, timeoutTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n // This useEffect is for showing the difference of the date to now\n if (shouldShowDateToNowDifference) {\n setFormattedDateString(getTimeTillNow({ date: formattedDate, currentDate, language }));\n }\n }, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);\n\n return useMemo(\n () => `${preText ? `${preText.trim()} ` : ''}${formattedDateString}`,\n [formattedDateString, preText],\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AA4CO,MAAMG,WAAW,GAAGA,CAAC;EACxBC,IAAI;EACJC,6BAA6B;EAC7BC,2BAA2B;EAC3BC,mBAAmB;EACnBC,cAAc;EACdC,kBAAkB;EAClBC,cAAc;EACdC;AACgB,CAAC,KAAK;EACtB,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAG,IAAAC,eAAQ,EAAS,EAAE,CAAC;EAC1E,MAAM,CAACC,QAAQ,CAAC,GAAG,IAAAD,eAAQ,EAAC,IAAAE,qBAAW,EAAC,CAAC,CAAC;EAE1C,MAAMC,aAAa,GAAG,IAAAC,cAAO,EAAC,MAAM,IAAIC,IAAI,CAACf,IAAI,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAE3D,MAAMgB,eAAe,GAAG,IAAAC,gBAAO,EAACjB,IAAI,CAAC,IAAI,IAAAkB,oBAAW,EAAClB,IAAI,CAAC,IAAI,IAAAmB,mBAAU,EAACnB,IAAI,CAAC;EAE9E,IAAAoB,gBAAS,EAAC,MAAM;IACZ;IACA,IAAInB,6BAA6B,EAAE;MAC/B;IACJ;IAEA,IAAIoB,sBAAsB,GAAG,IAAAC,+BAAqB,EAAC;MAC/CnB,mBAAmB;MACnBD,2BAA2B;MAC3BG,kBAAkB;MAClBL,IAAI,EAAEa,aA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AE,EACpE,CAACA,mBAAmB,EAAED,OAAO,CACjC,CAAC;AACL,CAAC;AAACqC,OAAA,CAAA7C,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { format, isPast } from 'date-fns';
1
+ import { format, isPast, isToday, isTomorrow, isYesterday } from 'date-fns';
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import { getFormattedDayOfWeek, getFormattedTime, getLanguage, getMonthFormat, getTimeTillNow, getYearFormat } from '../utils/dateInfo';
4
4
  export const useDateInfo = _ref => {
@@ -15,6 +15,7 @@ export const useDateInfo = _ref => {
15
15
  const [formattedDateString, setFormattedDateString] = useState('');
16
16
  const [language] = useState(getLanguage());
17
17
  const formattedDate = useMemo(() => new Date(date), [date]);
18
+ const isDateNearToday = isToday(date) || isYesterday(date) || isTomorrow(date);
18
19
  useEffect(() => {
19
20
  // This useEffect is used for normal date formation
20
21
  if (shouldShowDateToNowDifference) {
@@ -27,24 +28,28 @@ export const useDateInfo = _ref => {
27
28
  date: formattedDate,
28
29
  language
29
30
  });
30
- let formatString = 'dd. ';
31
- formatString += `${getMonthFormat({
32
- shouldUseShortText
33
- })}`;
34
- formatString += `${getYearFormat({
35
- date: formattedDate,
36
- shouldShowYear
37
- })}`;
38
- newFormattedDateString += format(formattedDate, formatString, {
39
- locale: language
40
- });
31
+ if (!isDateNearToday || !shouldShowRelativeDayOfWeek || !shouldShowTime) {
32
+ let formatString = 'dd. ';
33
+ formatString += `${getMonthFormat({
34
+ shouldUseShortText
35
+ })}`;
36
+ formatString += `${getYearFormat({
37
+ date: formattedDate,
38
+ shouldShowYear
39
+ })}`;
40
+ newFormattedDateString += format(formattedDate, formatString, {
41
+ locale: language
42
+ });
43
+ } else {
44
+ newFormattedDateString = newFormattedDateString.replace(', ', '');
45
+ }
41
46
  newFormattedDateString += getFormattedTime({
42
47
  date: formattedDate,
43
48
  shouldShowTime,
44
49
  language
45
50
  });
46
51
  setFormattedDateString(newFormattedDateString);
47
- }, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowYear, shouldShowTime, shouldUseShortText]);
52
+ }, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowYear, shouldShowTime, shouldUseShortText, isDateNearToday]);
48
53
 
49
54
  // Calculate remaining time till next minute to update time according to time left
50
55
  const [currentDate, setCurrentDate] = useState(new Date());
@@ -1 +1 @@
1
- {"version":3,"file":"useDateInfo.js","names":["format","isPast","useEffect","useMemo","useState","getFormattedDayOfWeek","getFormattedTime","getLanguage","getMonthFormat","getTimeTillNow","getYearFormat","useDateInfo","_ref","date","shouldShowDateToNowDifference","shouldShowRelativeDayOfWeek","shouldShowDayOfWeek","shouldShowTime","shouldUseShortText","shouldShowYear","preText","formattedDateString","setFormattedDateString","language","formattedDate","Date","newFormattedDateString","formatString","locale","currentDate","setCurrentDate","timeoutTime","getSeconds","timeDiffInMs","getTime","Math","max","timeout","setTimeout","clearTimeout","trim"],"sources":["../../../src/hooks/useDateInfo.ts"],"sourcesContent":["import { format, isPast } from 'date-fns';\nimport { useEffect, useMemo, useState } from 'react';\nimport {\n getFormattedDayOfWeek,\n getFormattedTime,\n getLanguage,\n getMonthFormat,\n getTimeTillNow,\n getYearFormat,\n} from '../utils/dateInfo';\n\nexport interface UseDateInfoOptions {\n /**\n * The date, that should be displayed\n */\n date: Date | string;\n /**\n * Additional text for \"shouldShowDateToNowDifference\" prop. Writes a text before the calculated time\n */\n preText?: string;\n /**\n * Adds the current year to the display\n */\n shouldShowYear?: boolean;\n /**\n * Adds the time to the display.\n */\n shouldShowTime?: boolean;\n /**\n * Whether the relative day of week to today should be shown (today, yesterday or tomorrow).\n */\n shouldShowRelativeDayOfWeek?: boolean;\n /**\n * Shortens the day and month text to maximum three digits\n */\n shouldUseShortText?: boolean;\n /**\n * Adds the day of week to the display\n */\n shouldShowDayOfWeek?: boolean;\n /**\n * Shows the difference from the date to now. The component handles updates itself.\n */\n shouldShowDateToNowDifference?: boolean;\n}\n\nexport const useDateInfo = ({\n date,\n shouldShowDateToNowDifference,\n shouldShowRelativeDayOfWeek,\n shouldShowDayOfWeek,\n shouldShowTime,\n shouldUseShortText,\n shouldShowYear,\n preText,\n}: UseDateInfoOptions) => {\n const [formattedDateString, setFormattedDateString] = useState<string>('');\n const [language] = useState(getLanguage());\n\n const formattedDate = useMemo(() => new Date(date), [date]);\n\n useEffect(() => {\n // This useEffect is used for normal date formation\n if (shouldShowDateToNowDifference) {\n return;\n }\n\n let newFormattedDateString = getFormattedDayOfWeek({\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n date: formattedDate,\n language,\n });\n\n let formatString = 'dd. ';\n\n formatString += `${getMonthFormat({ shouldUseShortText })}`;\n\n formatString += `${getYearFormat({\n date: formattedDate,\n shouldShowYear,\n })}`;\n\n newFormattedDateString += format(formattedDate, formatString, { locale: language });\n\n newFormattedDateString += getFormattedTime({\n date: formattedDate,\n shouldShowTime,\n language,\n });\n\n setFormattedDateString(newFormattedDateString);\n }, [\n date,\n formattedDate,\n language,\n shouldShowDateToNowDifference,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowYear,\n shouldShowTime,\n shouldUseShortText,\n ]);\n\n // Calculate remaining time till next minute to update time according to time left\n const [currentDate, setCurrentDate] = useState(new Date());\n\n useEffect(() => {\n // This useEffect is for calculating the current date for shouldShowDateToNowDifference option\n if (!shouldShowDateToNowDifference) {\n return () => {};\n }\n\n let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();\n\n // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently\n if (timeoutTime < 0) {\n timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();\n }\n\n // initialized with remaining time\n let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();\n\n // set to elapsed time\n if (isPast(formattedDate)) {\n timeDiffInMs = currentDate.getTime() - formattedDate.getTime();\n }\n\n // time difference is less than a minute, time should be updated every second\n if (timeDiffInMs < 60000) {\n timeoutTime = 1;\n }\n\n // Set timeoutTime to at least 1000ms\n timeoutTime = Math.max(timeoutTime * 1000, 1000);\n\n const timeout = setTimeout(() => {\n setCurrentDate(new Date());\n }, timeoutTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n // This useEffect is for showing the difference of the date to now\n if (shouldShowDateToNowDifference) {\n setFormattedDateString(getTimeTillNow({ date: formattedDate, currentDate, language }));\n }\n }, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);\n\n return useMemo(\n () => `${preText ? `${preText.trim()} ` : ''}${formattedDateString}`,\n [formattedDateString, preText],\n );\n};\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,UAAU;AACzC,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACpD,SACIC,qBAAqB,EACrBC,gBAAgB,EAChBC,WAAW,EACXC,cAAc,EACdC,cAAc,EACdC,aAAa,QACV,mBAAmB;AAqC1B,OAAO,MAAMC,WAAW,GAAGC,IAAA,IASD;EAAA,IATE;IACxBC,IAAI;IACJC,6BAA6B;IAC7BC,2BAA2B;IAC3BC,mBAAmB;IACnBC,cAAc;IACdC,kBAAkB;IAClBC,cAAc;IACdC;EACgB,CAAC,GAAAR,IAAA;EACjB,MAAM,CAACS,mBAAmB,EAAEC,sBAAsB,CAAC,GAAGlB,QAAQ,CAAS,EAAE,CAAC;EAC1E,MAAM,CAACmB,QAAQ,CAAC,GAAGnB,QAAQ,CAACG,WAAW,CAAC,CAAC,CAAC;EAE1C,MAAMiB,aAAa,GAAGrB,OAAO,CAAC,MAAM,IAAIsB,IAAI,CAACZ,IAAI,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAE3DX,SAAS,CAAC,MAAM;IACZ;IACA,IAAIY,6BAA6B,EAAE;MAC/B;IACJ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E;;IAEA;IACA,IAAIC,YAAY,GAAGT,aAAa,CAACU,OAAO,CAAC,CAAC,GAAGL,WAAW,CAACK,OAAO,CAAC,CAAC;;IAElE;IACA,IAAIjC,MAAM,CAACuB,aAAa,CAAC,EAAE;MACvBS,YAAY,GAAGJ,WAAW,CAACK,OAAO,CAAC,CAAC,GAAGV,aAAa,CAACU,OAAO,CAAC,CAAC;IAClE;;IAEA;IACA,IAAID,YAAY,GAAG,KAAK,EAAE;MACtBF,WAAW,GAAG,CAAC;IACnB;;IAEA;IACAA,WAAW,GAAGI,IAAI,CAACC,GAAG,CAACL,WAAW,GAAG,IAAI,EAAE,IAAI,CAAC;IAEhD,MAAMM,OAAO,GAAGC,UAAU,CAAC,MAAM;MAC7BR,cAAc,CAAC,IAAIL,IAAI,CAAC,CAAC,CAAC;IAC9B,CAAC,EAAEM,WAAW,CAAC;IAEf,OAAO,MAAM;MACTQ,YAAY,CAACF,OAAO,CAAC;IACzB,CAAC;EACL,CAAC,EAAE,CAACR,WAAW,EAAEhB,IAAI,EAAEW,aAAa,EAAEV,6BAA6B,CAAC,CAAC;EAErEZ,SAAS,CAAC,MAAM;IACZ;IACA,IAAIY,6BAA6B,EAAE;MAC/BQ,sBAAsB,CAACb,cAAc,CAAC;QAAEI,IAAI,EAAEW,aAAa;QAAEK,WAAW;QAAEN;MAAS,CAAC,CAAC,CAAC;IAC1F;EACJ,CAAC,EAAE,CAACM,WAAW,EAAEhB,IAAI,EAAEW,aAAa,EAAED,QAAQ,EAAET,6BAA6B,CAAC,CAAC;EAE/E,OAAOX,OAAO,CACV,MAAM,GAAGiB,OAAO,GAAG,GAAGA,OAAO,CAACoB,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAGnB,mBAAmB,EAAE,EACpE,CAACA,mBAAmB,EAAED,OAAO,CACjC,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useDateInfo.js","names":["format","isPast","isToday","isTomorrow","isYesterday","useEffect","useMemo","useState","getFormattedDayOfWeek","getFormattedTime","getLanguage","getMonthFormat","getTimeTillNow","getYearFormat","useDateInfo","_ref","date","shouldShowDateToNowDifference","shouldShowRelativeDayOfWeek","shouldShowDayOfWeek","shouldShowTime","shouldUseShortText","shouldShowYear","preText","formattedDateString","setFormattedDateString","language","formattedDate","Date","isDateNearToday","newFormattedDateString","formatString","locale","replace","currentDate","setCurrentDate","timeoutTime","getSeconds","timeDiffInMs","getTime","Math","max","timeout","setTimeout","clearTimeout","trim"],"sources":["../../../src/hooks/useDateInfo.ts"],"sourcesContent":["import { format, isPast, isToday, isTomorrow, isYesterday } from 'date-fns';\nimport { useEffect, useMemo, useState } from 'react';\nimport {\n getFormattedDayOfWeek,\n getFormattedTime,\n getLanguage,\n getMonthFormat,\n getTimeTillNow,\n getYearFormat,\n} from '../utils/dateInfo';\n\nexport interface UseDateInfoOptions {\n /**\n * The date, that should be displayed\n */\n date: Date | string;\n /**\n * Additional text for \"shouldShowDateToNowDifference\" prop. Writes a text before the calculated time\n */\n preText?: string;\n /**\n * Adds the current year to the display\n */\n shouldShowYear?: boolean;\n /**\n * Adds the time to the display.\n */\n shouldShowTime?: boolean;\n /**\n * Whether the relative day of week to today should be shown (today, yesterday or tomorrow).\n */\n shouldShowRelativeDayOfWeek?: boolean;\n /**\n * Shortens the day and month text to maximum three digits\n */\n shouldUseShortText?: boolean;\n /**\n * Adds the day of week to the display\n */\n shouldShowDayOfWeek?: boolean;\n /**\n * Shows the difference from the date to now. The component handles updates itself.\n */\n shouldShowDateToNowDifference?: boolean;\n}\n\nexport const useDateInfo = ({\n date,\n shouldShowDateToNowDifference,\n shouldShowRelativeDayOfWeek,\n shouldShowDayOfWeek,\n shouldShowTime,\n shouldUseShortText,\n shouldShowYear,\n preText,\n}: UseDateInfoOptions) => {\n const [formattedDateString, setFormattedDateString] = useState<string>('');\n const [language] = useState(getLanguage());\n\n const formattedDate = useMemo(() => new Date(date), [date]);\n\n const isDateNearToday = isToday(date) || isYesterday(date) || isTomorrow(date);\n\n useEffect(() => {\n // This useEffect is used for normal date formation\n if (shouldShowDateToNowDifference) {\n return;\n }\n\n let newFormattedDateString = getFormattedDayOfWeek({\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n date: formattedDate,\n language,\n });\n\n if (!isDateNearToday || !shouldShowRelativeDayOfWeek || !shouldShowTime) {\n let formatString = 'dd. ';\n\n formatString += `${getMonthFormat({ shouldUseShortText })}`;\n\n formatString += `${getYearFormat({\n date: formattedDate,\n shouldShowYear,\n })}`;\n\n newFormattedDateString += format(formattedDate, formatString, { locale: language });\n } else {\n newFormattedDateString = newFormattedDateString.replace(', ', '');\n }\n\n newFormattedDateString += getFormattedTime({\n date: formattedDate,\n shouldShowTime,\n language,\n });\n\n setFormattedDateString(newFormattedDateString);\n }, [\n date,\n formattedDate,\n language,\n shouldShowDateToNowDifference,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowYear,\n shouldShowTime,\n shouldUseShortText,\n isDateNearToday,\n ]);\n\n // Calculate remaining time till next minute to update time according to time left\n const [currentDate, setCurrentDate] = useState(new Date());\n\n useEffect(() => {\n // This useEffect is for calculating the current date for shouldShowDateToNowDifference option\n if (!shouldShowDateToNowDifference) {\n return () => {};\n }\n\n let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();\n\n // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently\n if (timeoutTime < 0) {\n timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();\n }\n\n // initialized with remaining time\n let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();\n\n // set to elapsed time\n if (isPast(formattedDate)) {\n timeDiffInMs = currentDate.getTime() - formattedDate.getTime();\n }\n\n // time difference is less than a minute, time should be updated every second\n if (timeDiffInMs < 60000) {\n timeoutTime = 1;\n }\n\n // Set timeoutTime to at least 1000ms\n timeoutTime = Math.max(timeoutTime * 1000, 1000);\n\n const timeout = setTimeout(() => {\n setCurrentDate(new Date());\n }, timeoutTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n // This useEffect is for showing the difference of the date to now\n if (shouldShowDateToNowDifference) {\n setFormattedDateString(getTimeTillNow({ date: formattedDate, currentDate, language }));\n }\n }, [currentDate, date, formattedDate, language, shouldShowDateToNowDifference]);\n\n return useMemo(\n () => `${preText ? `${preText.trim()} ` : ''}${formattedDateString}`,\n [formattedDateString, preText],\n );\n};\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAEC,WAAW,QAAQ,UAAU;AAC3E,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACpD,SACIC,qBAAqB,EACrBC,gBAAgB,EAChBC,WAAW,EACXC,cAAc,EACdC,cAAc,EACdC,aAAa,QACV,mBAAmB;AAqC1B,OAAO,MAAMC,WAAW,GAAGC,IAAA,IASD;EAAA,IATE;IACxBC,IAAI;IACJC,6BAA6B;IAC7BC,2BAA2B;IAC3BC,mBAAmB;IACnBC,cAAc;IACdC,kBAAkB;IAClBC,cAAc;IACdC;EACgB,CAAC,GAAAR,IAAA;EACjB,MAAM,CAACS,mBAAmB,EAAEC,sBAAsB,CAAC,GAAGlB,QAAQ,CAAS,EAAE,CAAC;EAC1E,MAAM,CAACmB,QAAQ,CAAC,GAAGnB,QAAQ,CAACG,WAAW,CAAC,CAAC,CAAC;EAE1C,MAAMiB,aAAa,GAAGrB,OAAO,CAAC,MAAM,IAAIsB,IAAI,CAACZ,IAAI,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAE3D,MAAMa,eAAe,GAAG3B,OAAO,CAACc,IAAI,CAAC,IAAIZ,WAAW,CAACY,IAAI,CAAC,IAAIb,UAAU,CAACa,IAAI,CAAC;EAE9EX,SAAS,CAAC,MAAM;IACZ;IACA,IAAIY,6BAA6B,EAAE;MAC/B;IACJ;IAEA,IAAIa,sBA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mBAAmB,EAAE,EACpE,CAACA,mBAAmB,EAAED,OAAO,CACjC,CAAC;AACL,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/date",
3
- "version": "5.0.0-beta.885",
3
+ "version": "5.0.0-beta.887",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -51,25 +51,25 @@
51
51
  "url": "https://github.com/TobitSoftware/chayns-components/issues"
52
52
  },
53
53
  "devDependencies": {
54
- "@babel/cli": "^7.25.7",
55
- "@babel/core": "^7.25.7",
56
- "@babel/preset-env": "^7.25.7",
57
- "@babel/preset-react": "^7.25.7",
58
- "@babel/preset-typescript": "^7.25.7",
59
- "@types/react": "^18.3.11",
60
- "@types/react-dom": "^18.3.0",
54
+ "@babel/cli": "^7.25.9",
55
+ "@babel/core": "^7.26.0",
56
+ "@babel/preset-env": "^7.26.0",
57
+ "@babel/preset-react": "^7.25.9",
58
+ "@babel/preset-typescript": "^7.26.0",
59
+ "@types/react": "^18.3.12",
60
+ "@types/react-dom": "^18.3.1",
61
61
  "@types/styled-components": "^5.1.34",
62
62
  "@types/uuid": "^10.0.0",
63
63
  "babel-loader": "^9.2.1",
64
64
  "cross-env": "^7.0.3",
65
- "lerna": "^8.1.8",
65
+ "lerna": "^8.1.9",
66
66
  "react": "^18.3.1",
67
67
  "react-dom": "^18.3.1",
68
68
  "styled-components": "^6.1.13",
69
69
  "typescript": "^5.6.3"
70
70
  },
71
71
  "dependencies": {
72
- "@chayns-components/core": "^5.0.0-beta.885",
72
+ "@chayns-components/core": "^5.0.0-beta.886",
73
73
  "date-fns": "^3.6.0",
74
74
  "uuid": "^10.0.0"
75
75
  },
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "77da4abecd17e83781b1c029cdeb1694d0d33244"
86
+ "gitHead": "8f999b0b61f445aa9e897dfae6d355e0a156ba03"
87
87
  }