Skip to content

Commit

Permalink
Merge pull request #58 from SnowSuno/hotfix/datetime
Browse files Browse the repository at this point in the history
🚑 Use moment in datetime parsing to support all browsers
  • Loading branch information
SnowSuno authored Dec 20, 2023
2 parents 8733e17 + 432c1cd commit d55d4f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"axios": "^1.5.1",
"classnames": "^2.3.1",
"lz-string": "^1.5.0",
"moment": "^2.29.4",
"react": "^17.0.2",
"react-copy-to-clipboard": "^5.0.3",
"react-device-detect": "^1.17.0",
Expand Down
3 changes: 2 additions & 1 deletion src/schema/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { z } from "zod";
import { creatorSchema, memberSchema } from "./member";
import { parseTags } from "@/utils/tag";
import { getId, getLanguage } from "@/utils/room";
import moment from "moment";

export const roomSourceSchema = z.object({
realm: z.number(),
Expand All @@ -17,7 +18,7 @@ export const roomSourceSchema = z.object({
numMembers: z.number(),
tagMask: z.coerce.number(),
tagOrig: z.string(),
createTime: z.coerce.date(),
createTime: z.string().transform(date => moment(date)),
});

export type RoomSource = z.infer<typeof roomSourceSchema>;
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8046,6 +8046,11 @@ mkdirp@^1.0.3, mkdirp@^1.0.4:
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==

moment@^2.29.4:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==

move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz"
Expand Down

0 comments on commit d55d4f7

Please sign in to comment.