feat: import dayjs from date module
This commit is contained in:
@@ -6,12 +6,6 @@ import { ChevronUpIcon } from "@heroicons/react/20/solid"
|
||||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { toIPFS, toGateway } from "~/lib/ipfs-parser"
|
||||
import { IPFS_SW_GATEWAY_PREFIX } from "~/lib/ipfs-gateway"
|
||||
import dayjs from "dayjs"
|
||||
import duration from "dayjs/plugin/duration"
|
||||
import relativeTime from "dayjs/plugin/relativeTime"
|
||||
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export const BlockchainInfo: React.FC<{
|
||||
site?: Profile | null
|
||||
|
||||
@@ -12,17 +12,12 @@ import {
|
||||
useDismiss,
|
||||
} from "@floating-ui/react-dom-interactions"
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import dayjs from "dayjs"
|
||||
import duration from "dayjs/plugin/duration"
|
||||
import relativeTime from "dayjs/plugin/relativeTime"
|
||||
import dayjs from "~/lib/date"
|
||||
import { FollowingButton } from "~/components/common/FollowingButton"
|
||||
import { FollowingCount } from "~/components/common/FollowingCount"
|
||||
import * as siteModel from "~/models/site.model"
|
||||
import type { Profile } from "~/lib/types"
|
||||
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export const CharacterCard: React.FC<{
|
||||
siteId?: string
|
||||
children: JSX.Element
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import dayjs from "dayjs"
|
||||
import duration from "dayjs/plugin/duration"
|
||||
import relativeTime from "dayjs/plugin/relativeTime"
|
||||
import dayjs from "~/lib/date"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
@@ -14,9 +12,6 @@ import { useState } from "react"
|
||||
import { CommentInput } from "~/components/common/CommentInput"
|
||||
import { CharacterCard } from "~/components/common/CharacterCard"
|
||||
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export const CommentItem: React.FC<{
|
||||
comment: NoteEntity & {
|
||||
character?: CharacterEntity | null
|
||||
|
||||
+17
-1
@@ -2,19 +2,35 @@ import dayjs from "dayjs"
|
||||
|
||||
import utc from "dayjs/plugin/utc"
|
||||
import tz from "dayjs/plugin/timezone"
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat"
|
||||
import duration from "dayjs/plugin/duration"
|
||||
import relativeTime from "dayjs/plugin/relativeTime"
|
||||
|
||||
dayjs.extend(localizedFormat)
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(tz)
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export const formatDate = (
|
||||
date: string | Date,
|
||||
format: "MMM D" | "MMM D, YYYY" | "YYYY" = "MMM D, YYYY",
|
||||
timezone?: string,
|
||||
) => {
|
||||
console.log("date", date, timezone, format)
|
||||
console.log(
|
||||
"date",
|
||||
date,
|
||||
timezone,
|
||||
format,
|
||||
dayjs(date),
|
||||
dayjs(date).tz(timezone),
|
||||
dayjs(date).tz(timezone).format(format),
|
||||
)
|
||||
return dayjs(date).tz(timezone).format(format)
|
||||
}
|
||||
|
||||
export const inLocalTimezone = (date: string | Date) => {
|
||||
return dayjs(date).tz().toDate()
|
||||
}
|
||||
|
||||
export default dayjs
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import dayjs from "dayjs"
|
||||
import dayjs from "~/lib/date"
|
||||
import { PageVisibilityEnum } from "./types"
|
||||
|
||||
export const getPageVisibility = ({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import clsx from "clsx"
|
||||
import dayjs from "dayjs"
|
||||
import dayjs from "~/lib/date"
|
||||
import { useRouter } from "next/router"
|
||||
import {
|
||||
ChangeEvent,
|
||||
|
||||
@@ -6,18 +6,13 @@ import { getSiteLink } from "~/lib/helpers"
|
||||
import { useGetNotifications, useGetSite } from "~/queries/site"
|
||||
import { CharacterCard } from "~/components/common/CharacterCard"
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
import dayjs from "dayjs"
|
||||
import duration from "dayjs/plugin/duration"
|
||||
import relativeTime from "dayjs/plugin/relativeTime"
|
||||
import dayjs from "~/lib/date"
|
||||
import { BlockchainIcon } from "~/components/icons/BlockchainIcon"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { PageContent } from "~/components/common/PageContent"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import { setStorage, getStorage } from "~/lib/storage"
|
||||
|
||||
dayjs.extend(duration)
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export default function SubdomainIndex() {
|
||||
const router = useRouter()
|
||||
const subdomain = router.query.subdomain as string
|
||||
|
||||
Reference in New Issue
Block a user