Skip to content

Commit

Permalink
moment削除
Browse files Browse the repository at this point in the history
  • Loading branch information
tmikada committed Mar 23, 2024
1 parent 782458b commit 47a5dbb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

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

1 change: 0 additions & 1 deletion workspaces/app/package.json
Expand Up @@ -12,7 +12,6 @@
"jotai": "2.7.0",
"jquery": "3.7.1",
"lodash": "4.17.21",
"moment-timezone": "0.5.45",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "6.18.0",
Expand Down
6 changes: 3 additions & 3 deletions workspaces/app/src/lib/date/getDayOfWeekStr.ts
@@ -1,9 +1,9 @@
import type moment from 'moment-timezone';
// import type moment from 'moment-timezone';

const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'] as const;

export const getDayOfWeekStr = (date: moment.Moment) => {
const dayOfWeek = date.day();
export const getDayOfWeekStr = (date: Date) => {
const dayOfWeek = date.getDay();
const dayStr = days.at(dayOfWeek);
if (dayStr == null) {
throw new Error('dayOfWeek is invalid');
Expand Down
4 changes: 2 additions & 2 deletions workspaces/app/src/pages/TopPage/index.tsx
@@ -1,5 +1,5 @@
import _ from 'lodash';
import moment from 'moment-timezone';
// import moment from 'moment-timezone';
import { Suspense, useId } from 'react';

import { BookCard } from '../../features/book/components/BookCard';
Expand All @@ -18,7 +18,7 @@ import { getDayOfWeekStr } from '../../lib/date/getDayOfWeekStr';
import { CoverSection } from './internal/CoverSection';

const TopPage: React.FC = () => {
const todayStr = getDayOfWeekStr(moment());
const todayStr = getDayOfWeekStr(new Date());
const { data: release } = useRelease({ params: { dayOfWeek: todayStr } });
const { data: featureList } = useFeatureList({ query: {} });
const { data: rankingList } = useRankingList({ query: {} });
Expand Down
4 changes: 2 additions & 2 deletions workspaces/server/src/routes/ssr/index.tsx
Expand Up @@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
import { Hono } from 'hono';
import { HTTPException } from 'hono/http-exception';
import jsesc from 'jsesc';
import moment from 'moment-timezone';
// import moment from 'moment-timezone';
import ReactDOMServer from 'react-dom/server';
import { StaticRouter } from 'react-router-dom/server';
import { ServerStyleSheet } from 'styled-components';
Expand All @@ -23,7 +23,7 @@ async function createInjectDataStr(): Promise<Record<string, unknown>> {
const json: Record<string, unknown> = {};

{
const dayOfWeek = getDayOfWeekStr(moment());
const dayOfWeek = getDayOfWeekStr(new Date());
const releases = await releaseApiClient.fetch({ params: { dayOfWeek } });
json[unstable_serialize(releaseApiClient.fetch$$key({ params: { dayOfWeek } }))] = releases;
}
Expand Down

0 comments on commit 47a5dbb

Please sign in to comment.