chore: date and time standardization all across the platform. (#3283)
* chore: date and time standardization all across the platform. * chore: update `renderFormattedTime` function. * remove unwanted code. * fix: build errors * chore: update `renderFormattedTime` function params.
This commit is contained in:
parent
d9ee692ce9
commit
1539340113
65 changed files with 366 additions and 723 deletions
|
|
@ -11,11 +11,9 @@ import { snoozeOptions } from "constants/notification";
|
|||
// helper
|
||||
import { replaceUnderscoreIfSnakeCase, truncateText, stripAndTruncateHTML } from "helpers/string.helper";
|
||||
import {
|
||||
formatDateDistance,
|
||||
render12HourFormatTime,
|
||||
renderLongDateFormat,
|
||||
renderShortDate,
|
||||
renderShortDateWithYearFormat,
|
||||
calculateTimeAgo,
|
||||
renderFormattedTime,
|
||||
renderFormattedDate,
|
||||
} from "helpers/date-time.helper";
|
||||
// type
|
||||
import type { IUserNotification } from "types";
|
||||
|
|
@ -112,7 +110,7 @@ export const NotificationCard: React.FC<NotificationCardProps> = (props) => {
|
|||
{notification.data.issue_activity.field !== "None" ? (
|
||||
notification.data.issue_activity.field !== "comment" ? (
|
||||
notification.data.issue_activity.field === "target_date" ? (
|
||||
renderShortDateWithYearFormat(notification.data.issue_activity.new_value)
|
||||
renderFormattedDate(notification.data.issue_activity.new_value)
|
||||
) : notification.data.issue_activity.field === "attachment" ? (
|
||||
"the issue"
|
||||
) : notification.data.issue_activity.field === "description" ? (
|
||||
|
|
@ -151,11 +149,11 @@ export const NotificationCard: React.FC<NotificationCardProps> = (props) => {
|
|||
<p className="flex flex-shrink-0 items-center justify-end gap-x-1 text-custom-text-300">
|
||||
<Clock className="h-4 w-4" />
|
||||
<span>
|
||||
Till {renderShortDate(notification.snoozed_till)}, {render12HourFormatTime(notification.snoozed_till)}
|
||||
Till {renderFormattedDate(notification.snoozed_till)}, {renderFormattedTime(notification.snoozed_till, '12-hour')}
|
||||
</span>
|
||||
</p>
|
||||
) : (
|
||||
<p className="flex-shrink-0 text-custom-text-300">{formatDateDistance(notification.created_at)}</p>
|
||||
<p className="flex-shrink-0 text-custom-text-300">{calculateTimeAgo(notification.created_at)}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -233,7 +231,7 @@ export const NotificationCard: React.FC<NotificationCardProps> = (props) => {
|
|||
|
||||
markSnoozeNotification(notification.id, item.value).then(() => {
|
||||
setToastAlert({
|
||||
title: `Notification snoozed till ${renderLongDateFormat(item.value)}`,
|
||||
title: `Notification snoozed till ${renderFormattedDate(item.value)}`,
|
||||
type: "success",
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { useRouter } from "next/router";
|
|||
import { useForm, Controller } from "react-hook-form";
|
||||
import { Transition, Dialog } from "@headlessui/react";
|
||||
import { X } from "lucide-react";
|
||||
// date helper
|
||||
import { getAllTimeIn30MinutesInterval } from "helpers/date-time.helper";
|
||||
// constants
|
||||
import { allTimeIn30MinutesInterval12HoursFormat } from "constants/notification";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
// ui
|
||||
|
|
@ -33,7 +33,7 @@ const defaultValues: FormValues = {
|
|||
period: "AM",
|
||||
};
|
||||
|
||||
const timeStamps = getAllTimeIn30MinutesInterval();
|
||||
const timeStamps = allTimeIn30MinutesInterval12HoursFormat;
|
||||
|
||||
export const SnoozeNotificationModal: FC<SnoozeModalProps> = (props) => {
|
||||
const { isOpen, onClose, notification, onSuccess, onSubmit: handleSubmitSnooze } = props;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue