diff --git a/app/(dashboard)/[tenant]/projects/[projectId]/events/actions.ts b/app/(dashboard)/[tenant]/projects/[projectId]/events/actions.ts
index 4e9b8fc..b1ac200 100644
--- a/app/(dashboard)/[tenant]/projects/[projectId]/events/actions.ts
+++ b/app/(dashboard)/[tenant]/projects/[projectId]/events/actions.ts
@@ -2,7 +2,11 @@
import { calendarEvent, eventInvite } from "@/drizzle/schema";
import { generateObjectDiffMessage, logActivity } from "@/lib/activity";
-import { toDateString, toEndOfDay } from "@/lib/utils/date";
+import {
+ toDateString,
+ toEndOfDay,
+ toMachineDateString,
+} from "@/lib/utils/date";
import { database } from "@/lib/utils/useDatabase";
import { getOwner, getTimezone } from "@/lib/utils/useOwner";
import { and, eq } from "drizzle-orm";
@@ -99,7 +103,7 @@ export async function createEvent(payload: FormData) {
revalidatePath(`/${orgSlug}/projects/${projectId}/events`);
redirect(
- `/${orgSlug}/projects/${projectId}/events?on=${toDateString(start, timezone)}`,
+ `/${orgSlug}/projects/${projectId}/events?on=${toMachineDateString(start, timezone)}`,
);
}
@@ -169,7 +173,7 @@ export async function updateEvent(payload: FormData) {
revalidatePath(`/${orgSlug}/projects/${projectId}/events`);
redirect(
- `/${orgSlug}/projects/${projectId}/events?on=${toDateString(start, timezone)}`,
+ `/${orgSlug}/projects/${projectId}/events?on=${toMachineDateString(start, timezone)}`,
);
}
diff --git a/app/(dashboard)/[tenant]/projects/[projectId]/page.tsx b/app/(dashboard)/[tenant]/projects/[projectId]/page.tsx
index 7044cde..1b2e83f 100644
--- a/app/(dashboard)/[tenant]/projects/[projectId]/page.tsx
+++ b/app/(dashboard)/[tenant]/projects/[projectId]/page.tsx
@@ -16,6 +16,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
+import { toDateStringWithDay } from "@/lib/utils/date";
import { getOwner, getTimezone } from "@/lib/utils/useOwner";
import { getProjectById } from "@/lib/utils/useProjects";
import { CalendarPlusIcon, ListPlusIcon, PlusIcon } from "lucide-react";
@@ -53,7 +54,7 @@ export default async function ProjectDetails(props: Props) {
{project.dueDate ? (
- Due {project.dueDate.toLocaleDateString()}
+ Due {toDateStringWithDay(project.dueDate, timezone)}
) : null}
{project.status === "archived" ? (
@@ -141,6 +142,7 @@ export default async function ProjectDetails(props: Props) {
>
task.status === "done").length;
+ const totalCount = list.tasks.length;
+ const doneCount = list.tasks.filter((task) => task.status === "done").length;
- const completedPercent =
+ const completedPercent =
totalCount != null && doneCount != null
? Math.round((doneCount / totalCount) * 100)
: null;
- return (
+ return (
<>
+
{list.dueDate ? (
- Due {list.dueDate.toLocaleDateString()}
+ Due {toDateStringWithDay(list.dueDate, timezone)}
) : null}
@@ -116,6 +118,7 @@ export default async function TaskLists(props: Props) {
eq(taskList.status, status),
@@ -92,6 +93,7 @@ export default async function TaskLists(props: Props) {
createTask={createTask}
partialUpdateTaskList={partialUpdateTaskList}
orgSlug={orgSlug}
+ timezone={timezone}
compact
/>
))}
diff --git a/app/(dashboard)/[tenant]/today/page.tsx b/app/(dashboard)/[tenant]/today/page.tsx
index 472eec0..7111fb7 100644
--- a/app/(dashboard)/[tenant]/today/page.tsx
+++ b/app/(dashboard)/[tenant]/today/page.tsx
@@ -5,12 +5,14 @@ import { TaskItem } from "@/components/project/tasklist/task/task-item";
import { task } from "@/drizzle/schema";
import { isSameDate } from "@/lib/utils/date";
import { database } from "@/lib/utils/useDatabase";
+import { getTimezone } from "@/lib/utils/useOwner";
import { and, asc, lte, ne } from "drizzle-orm";
import { AlertTriangleIcon, InfoIcon } from "lucide-react";
export default async function Today() {
const db = await database();
+ const timezone = await getTimezone();
const tasks = await db.query.task.findMany({
where: and(lte(task.dueDate, new Date()), ne(task.status, "done")),
orderBy: [asc(task.position)],
@@ -68,6 +70,7 @@ export default async function Today() {
key={task.id}
task={task}
projectId={+task.taskList.projectId}
+ timezone={timezone}
compact
/>
))}
@@ -85,6 +88,7 @@ export default async function Today() {
key={task.id}
task={task}
projectId={+task.taskList.projectId}
+ timezone={timezone}
compact
/>
))}
diff --git a/components/project/events/events-calendar.tsx b/components/project/events/events-calendar.tsx
index 5e4db31..60cb35d 100644
--- a/components/project/events/events-calendar.tsx
+++ b/components/project/events/events-calendar.tsx
@@ -38,7 +38,7 @@ export default function EventsCalendar({
selected={new Date(currentDate)}
onDayClick={(date) => {
router.push(
- `/${orgSlug}/projects/${projectId}/events?on=${currentDate}`,
+ `/${orgSlug}/projects/${projectId}/events?on=${date.toISOString()}`,
);
}}
/>
diff --git a/components/project/tasklist/task/task-item.tsx b/components/project/tasklist/task/task-item.tsx
index 0f1cab5..1a6691b 100644
--- a/components/project/tasklist/task/task-item.tsx
+++ b/components/project/tasklist/task/task-item.tsx
@@ -16,6 +16,7 @@ import {
import { Input } from "@/components/ui/input";
import type { Task, TaskList, TaskWithDetails, User } from "@/drizzle/types";
import { cn } from "@/lib/utils";
+import { toDateStringWithDay } from "@/lib/utils/date";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { AlignJustifyIcon, FileIcon } from "lucide-react";
@@ -32,10 +33,12 @@ export const TaskItem = ({
task,
projectId,
taskLists,
+ timezone,
compact = false,
}: {
task: TaskWithDetails;
projectId: number;
+ timezone: string;
taskLists?: TaskList[];
compact?: boolean;
}) => {
@@ -215,7 +218,7 @@ export const TaskItem = ({
{task.dueDate ? (
-
{task.dueDate.toLocaleDateString()}
+
{toDateStringWithDay(task.dueDate, timezone)}
-
+
{totalCount != null && doneCount != null ? (
@@ -71,12 +74,12 @@ export const TaskListHeader = ({
) : null}
{taskList.dueDate ? (
-
+
{taskList.dueDate ? (
- Due {taskList.dueDate.toLocaleDateString()}
+ Due {toDateStringWithDay(taskList.dueDate, timezone)}
) : null}
diff --git a/components/project/tasklist/tasklist.tsx b/components/project/tasklist/tasklist.tsx
index 91d2fd0..00b87eb 100644
--- a/components/project/tasklist/tasklist.tsx
+++ b/components/project/tasklist/tasklist.tsx
@@ -33,6 +33,7 @@ export const TaskListItem = ({
orgSlug,
createTask,
partialUpdateTaskList,
+ timezone,
hideHeader = false,
compact = false,
}: {
@@ -40,6 +41,7 @@ export const TaskListItem = ({
userId: string;
projectId: number;
orgSlug: string;
+ timezone: string;
createTask: (data: {
name: string;
userId: string;
@@ -118,6 +120,7 @@ export const TaskListItem = ({
doneCount={doneItems.length}
orgSlug={orgSlug}
partialUpdateTaskList={partialUpdateTaskList}
+ timezone={timezone}
/>
) : null}
@@ -145,6 +148,7 @@ export const TaskListItem = ({
>
{localTodoItems.map((task) => (
(
-
+
))}
diff --git a/lib/utils/date.ts b/lib/utils/date.ts
index c2a8f09..fc0f9fc 100644
--- a/lib/utils/date.ts
+++ b/lib/utils/date.ts
@@ -37,9 +37,9 @@ export function toDateTimeString(date: Date, timeZone: string) {
export function toDateStringWithDay(date: Date, timeZone: string) {
return date.toLocaleDateString("en-US", {
timeZone,
- weekday: "long",
+ weekday: "short",
year: "numeric",
- month: "long",
+ month: "short",
day: "numeric",
});
}