Skip to content

Commit

Permalink
Merge pull request #13 from icssc/human-readable-timefields
Browse files Browse the repository at this point in the history
feat: make date columns human readable
  • Loading branch information
alexanderl19 authored Feb 5, 2024
2 parents 423b0a0 + 3544789 commit b0cf654
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/util/formatDateToPST.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const formatDateToPST = (dateValue: string): string => {
return new Date(dateValue).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
timeZone: "America/Los_Angeles",
});
};
3 changes: 3 additions & 0 deletions src/routes/(nav)/[[selectedMember]]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import type { GetContacts } from "$api/contacts";
import LineTableRow from "$lib/components/LineTableRow.svelte";
import { formatDateToPST } from "$lib/util/formatDateToPST";
export let data: PageData;
Expand Down Expand Up @@ -45,9 +46,11 @@
}),
columnHelper.accessor("lastContactDate", {
header: "Last Contact Date",
cell: (props) => formatDateToPST(props.getValue()),
}),
columnHelper.accessor("followupDate", {
header: "Followup Date",
cell: (props) => formatDateToPST(props.getValue()),
}),
columnHelper.accessor("notes", {
header: "Notes",
Expand Down

0 comments on commit b0cf654

Please sign in to comment.