Skip to content

Commit

Permalink
support japanese holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
7kaji committed Sep 30, 2018
1 parent 7b51a58 commit 61377b6
Show file tree
Hide file tree
Showing 3 changed files with 1,018 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"@fortawesome/free-regular-svg-icons": "^5.3.1",
"@fortawesome/free-solid-svg-icons": "^5.3.1",
"@fortawesome/react-fontawesome": "^0.1.3",
"@holiday-jp/holiday_jp": "^2.1.0",
"@types/luxon": "^1.2.2",
"@types/react": "^16.4.8",
"@types/react-dom": "^16.0.7",
Expand Down
7 changes: 7 additions & 0 deletions src/demo/2-calendar/Calendar.tsx
Expand Up @@ -3,6 +3,7 @@ import { DateTime } from "luxon";
import styled, { css } from "styled-components";
import { generateFilledCalendar } from "./getMonthDate";
import { gridDebug } from "components/grid/debug";
import holiday_jp from "@holiday-jp/holiday_jp";

type CalendarProps = {
year: number;
Expand Down Expand Up @@ -47,6 +48,9 @@ export const Month = styled.div`
`;

const getFontColor = (date: DateTime) => {
if (holiday_jp.isHoliday(new Date(`${date.year}/${date.month}/${date.day}`))) {
return "#fff";
}
switch (date.weekday) {
case 7:
case 6:
Expand All @@ -56,6 +60,9 @@ const getFontColor = (date: DateTime) => {
}
};
const getBgColor = (date: DateTime) => {
if (holiday_jp.isHoliday(new Date(`${date.year}/${date.month}/${date.day}`))) {
return "#f7481d";
}
switch (date.weekday) {
case 7:
return "#f7481d";
Expand Down

0 comments on commit 61377b6

Please sign in to comment.