-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
303f67a
commit cdd380b
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
commit: | ||
npx git-cz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<html lang="ja"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>スケジュール生成</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
} | ||
.schedule { | ||
margin: 20px; | ||
padding: 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
width: 300px; | ||
text-align: center; | ||
} | ||
.input-container { | ||
text-align: center; | ||
margin: 20px; | ||
} | ||
.input-container input { | ||
margin: 5px; | ||
} | ||
.schedule textarea { | ||
width: 100%; | ||
height: 300px; | ||
margin-top: 10px; | ||
font-family: Arial, sans-serif; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="input-container"> | ||
<label for="year">年:</label> | ||
<input type="number" id="year" value="2024"> | ||
<label for="month">月:</label> | ||
<input type="number" id="month" value="8"> | ||
<button onclick="updateSchedule()">更新</button> | ||
</div> | ||
|
||
<div class="schedule"> | ||
<h2>スケジュール</h2> | ||
<textarea id="schedule-text" readonly></textarea> | ||
</div> | ||
|
||
<script> | ||
function getSchedule(year, month) { | ||
const japaneseWeekdays = ["月", "火", "水", "木", "金", "土", "日"]; | ||
const schedule = []; | ||
const daysInMonth = new Date(year, month, 0).getDate(); // Get the number of days in the given month | ||
|
||
for (let day = 1; day <= daysInMonth; day++) { | ||
const date = new Date(year, month - 1, day); | ||
const weekday = date.getDay(); | ||
const dayName = japaneseWeekdays[weekday === 0 ? 6 : weekday - 1]; // Get the Japanese weekday name | ||
|
||
if (weekday >= 1 && weekday <= 5) { // Monday to Friday | ||
schedule.push(`${month}/${day}(${dayName}) 20:00〜`); | ||
} else { // Saturday and Sunday | ||
schedule.push(`${month}/${day}(${dayName}) 10:00〜`); | ||
schedule.push(`${month}/${day}(${dayName}) 14:00〜`); | ||
schedule.push(`${month}/${day}(${dayName}) 20:00〜`); | ||
} | ||
} | ||
return schedule.join('\n'); | ||
} | ||
|
||
function displaySchedule(year, month) { | ||
const schedule = getSchedule(year, month); | ||
const scheduleText = document.getElementById("schedule-text"); | ||
scheduleText.value = schedule; | ||
} | ||
|
||
function updateSchedule() { | ||
const year = document.getElementById("year").value; | ||
const month = document.getElementById("month").value; | ||
displaySchedule(year, month); | ||
} | ||
|
||
// Initial display with default values | ||
updateSchedule(); | ||
</script> | ||
</body> | ||
</html> |