The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { type Temporal } from 'temporal-polyfill';
export const turnPlainDateToShiftedDateInSystemTimeZone = (
plainDate: Temporal.PlainDate,
) => {
const systemTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const dateShiftedToISOString = plainDate
.toZonedDateTime(systemTimeZone)
.toInstant()
.toString();
const dateForDatePicker = new Date(dateShiftedToISOString);
return dateForDatePicker;
};