Skip to content

Commit

Permalink
Switch to DayJS from MomentJS
Browse files Browse the repository at this point in the history
  • Loading branch information
0deans committed Mar 19, 2024
1 parent 102cb77 commit 0e95839
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
7 changes: 3 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
PUBLIC_URL=

DATABASE_URL=
BLOB_READ_WRITE_TOKEN=
RESEND_API_KEY=

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

RESEND_API_KEY=
GOOGLE_CLIENT_SECRET=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
my_temp
my_temp
.vercel
.env*.local
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
engine-strict=true
resolution-mode=highest
use-node-version=18.19.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"@types/ua-parser-js": "^0.7.39",
"arctic": "^1.1.4",
"clsx": "^2.1.0",
"dayjs": "^1.11.10",
"lucia": "^3.0.1",
"moment": "^2.30.1",
"oslo": "^1.0.4",
"prisma": "^5.9.1",
"resend": "^3.2.0",
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/routes/(protected)/profile/sessions/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { prisma } from "$lib/server/prisma";
import { fail, redirect } from "@sveltejs/kit";
import { lucia } from "$lib/server/auth";
import UAParser from "ua-parser-js";
import moment from "moment";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import type { Actions, PageServerLoad } from "./$types";

export const load: PageServerLoad = async ({ parent, locals }) => {
Expand All @@ -13,9 +14,10 @@ export const load: PageServerLoad = async ({ parent, locals }) => {
}
});

dayjs.extend(relativeTime);
const sessions = userSessions.map((session) => {
let parser = new UAParser(session.userAgent);
let createdAt = moment(session.createdAt).fromNow();
let createdAt = dayjs(session.createdAt).fromNow();
return {
id: session.id,
createdAt,
Expand Down

0 comments on commit 0e95839

Please sign in to comment.