mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-22 10:08:42 -06:00
fix: add time to exports (#4430)
Co-authored-by: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3509d3594f
commit
264ebb1d4c
@@ -10,7 +10,7 @@ import Link from "next/link";
|
||||
import { getLocalizedValue } from "@formbricks/lib/i18n/utils";
|
||||
import { processResponseData } from "@formbricks/lib/responses";
|
||||
import { getContactIdentifier } from "@formbricks/lib/utils/contact";
|
||||
import { getFormattedDate, getFormattedTime } from "@formbricks/lib/utils/datetime";
|
||||
import { getFormattedDateTimeString } from "@formbricks/lib/utils/datetime";
|
||||
import { QUESTIONS_ICON_MAP, VARIABLES_ICON_MAP } from "@formbricks/lib/utils/questions";
|
||||
import { recallToHeadline } from "@formbricks/lib/utils/recall";
|
||||
import { TResponseTableData } from "@formbricks/types/responses";
|
||||
@@ -182,12 +182,7 @@ export const generateResponseTableColumns = (
|
||||
size: 200,
|
||||
cell: ({ row }) => {
|
||||
const date = new Date(row.original.createdAt);
|
||||
return (
|
||||
<div>
|
||||
<p className="text-slate-900">{getFormattedDate(date)}</p>
|
||||
<p className="text-slate-900">{getFormattedTime(date)}</p>
|
||||
</div>
|
||||
);
|
||||
return <p className="text-slate-900">{getFormattedDateTimeString(date)}</p>;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ import { getLocalizedValue } from "@formbricks/lib/i18n/utils";
|
||||
import { writeData as writeNotionData } from "@formbricks/lib/notion/service";
|
||||
import { processResponseData } from "@formbricks/lib/responses";
|
||||
import { writeDataToSlack } from "@formbricks/lib/slack/service";
|
||||
import { getFormattedDate } from "@formbricks/lib/utils/datetime";
|
||||
import { getFormattedTime } from "@formbricks/lib/utils/datetime";
|
||||
import { getFormattedDateTimeString } from "@formbricks/lib/utils/datetime";
|
||||
import { parseRecallInfo } from "@formbricks/lib/utils/recall";
|
||||
import { TAttributes } from "@formbricks/types/attributes";
|
||||
import { TContactAttributes } from "@formbricks/types/contact-attribute";
|
||||
@@ -64,7 +63,7 @@ const processDataForIntegration = async (
|
||||
}
|
||||
if (includeCreatedAt) {
|
||||
const date = new Date(data.response.createdAt);
|
||||
values[0].push(`${getFormattedDate(date)} ${getFormattedTime(date)}`);
|
||||
values[0].push(`${getFormattedDateTimeString(date)}`);
|
||||
values[1].push("Created At");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { TSurvey } from "@formbricks/types/surveys/types";
|
||||
import { getLocalizedValue } from "../i18n/utils";
|
||||
import { processResponseData } from "../responses";
|
||||
import { getTodaysDateTimeFormatted } from "../time";
|
||||
import { getFormattedDateTimeString } from "../utils/datetime";
|
||||
import { sanitizeString } from "../utils/strings";
|
||||
|
||||
export const calculateTtcTotal = (ttc: TResponseTtc) => {
|
||||
@@ -497,7 +498,7 @@ export const getResponsesJson = (
|
||||
jsonData.push({
|
||||
"No.": idx + 1,
|
||||
"Response ID": response.id,
|
||||
Timestamp: response.createdAt.toDateString(),
|
||||
Timestamp: getFormattedDateTimeString(response.createdAt),
|
||||
Finished: response.finished ? "Yes" : "No",
|
||||
"Survey ID": response.surveyId,
|
||||
"Formbricks ID (internal)": response.contact?.id || "",
|
||||
|
||||
@@ -68,18 +68,16 @@ export const isValidDateString = (value: string) => {
|
||||
return date;
|
||||
};
|
||||
|
||||
export const getFormattedDate = (date: Date) => {
|
||||
return date.toLocaleString(undefined, {
|
||||
export const getFormattedDateTimeString = (date: Date): string => {
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
});
|
||||
};
|
||||
|
||||
export const getFormattedTime = (date: Date) => {
|
||||
return date.toLocaleString(undefined, {
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
hour12: false,
|
||||
});
|
||||
};
|
||||
|
||||
return new Intl.DateTimeFormat("en-CA", options).format(date).replace(",", "");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user