Skip to content

Commit

Permalink
fix: 祝日判定をjapanese-holidays使用に変更
Browse files Browse the repository at this point in the history
  • Loading branch information
yudai1204 committed May 8, 2024
1 parent 523029d commit 2e52286
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1,409 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"date-fns": "^3.6.0",
"encoding-japanese": "^2.1.0",
"ical": "^0.8.0",
"japanese-holidays": "^1.0.10",
"jszip": "^3.10.1",
"markdown-it": "^14.1.0",
"node-sass": "^9.0.0",
Expand Down
2 changes: 0 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ export const SLIDER_BAR_MINS = [

export const MAX_MEMO_COUNT = 30;
export const MAX_HIDDEN_TASKS = 150;

export { holidays } from "./holidays";
6 changes: 3 additions & 3 deletions src/contents/components/Calender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Box, IconButton, Typography, ButtonGroup, Collapse, Button } from "@mui
import { deepOrange, indigo } from "@mui/material/colors";
import { lastDayOfMonth, format } from "date-fns";
import ICAL from "ical";
import JapaneseHolidays from "japanese-holidays";
import { useState, useEffect, useMemo } from "react";
import { MdKeyboardArrowDown, MdKeyboardArrowUp } from "react-icons/md";
import type { CalEvent } from "../types/calender";
import { holidays } from "~constants";
import { defaultSaves, type Saves } from "~settings";

const days =
Expand Down Expand Up @@ -37,7 +37,7 @@ const Day = (props: DayProps) => {
}}
onClick={() => onClick?.(date)}
>
{holiday && !holiday.includes("振替休日") && (
{holiday && (
<Typography
variant="body2"
fontSize="9px"
Expand Down Expand Up @@ -157,7 +157,7 @@ const MyCalender = (props: MyCalenderProps) => {
onClick={onClick}
isSunday={thisDate.getDay() === 0}
isSaturday={thisDate.getDay() === 6}
holiday={holidays.find((d) => d.start === formatThisDate)?.summary}
holiday={JapaneseHolidays.isHoliday(thisDate)}
isSelected={
targetDay.getDate() === i + 1 && targetDay.getMonth() === month && targetDay.getFullYear() === year
}
Expand Down
Loading

0 comments on commit 2e52286

Please sign in to comment.