chore: update time in real-time in dashboard and profile sidebar (#3489)

* chore: update dashboard and profile time in realtime

* chore: remove seconds

* fix: cycle and module sidebar datepicker
This commit is contained in:
Aaryan Khandelwal 2024-01-29 15:42:57 +05:30 committed by GitHub
parent b3393f5c48
commit 3c9679dff9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 280 additions and 201 deletions

View file

@ -7,6 +7,8 @@ import { observer } from "mobx-react-lite";
import { useUser } from "hooks/store";
// services
import { UserService } from "services/user.service";
// components
import { ProfileSidebarTime } from "./time";
// ui
import { Loader, Tooltip } from "@plane/ui";
// icons
@ -34,16 +36,6 @@ export const ProfileSidebar = observer(() => {
: null
);
// Create a date object for the current time in the specified timezone
const currentTime = new Date();
const formatter = new Intl.DateTimeFormat("en-US", {
timeZone: userProjectsData?.user_data.user_timezone,
hour12: false, // Use 24-hour format
hour: "2-digit",
minute: "2-digit",
});
const timeString = formatter.format(currentTime);
const userDetails = [
{
label: "Joined on",
@ -51,11 +43,7 @@ export const ProfileSidebar = observer(() => {
},
{
label: "Timezone",
value: (
<span>
{timeString} <span className="text-custom-text-200">{userProjectsData?.user_data.user_timezone}</span>
</span>
),
value: <ProfileSidebarTime timeZone={userProjectsData?.user_data.user_timezone} />,
},
];