var validdates = [
{
"Date": "2026-06-11",
"Month": 6,
"Day": 11,
"ProductCount": "4件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260611/comiket_deadline_to:20260611"
},
{
"Date": "2026-06-12",
"Month": 6,
"Day": 12,
"ProductCount": "2件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260612/comiket_deadline_to:20260612"
},
{
"Date": "2026-06-15",
"Month": 6,
"Day": 15,
"ProductCount": "4件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260615/comiket_deadline_to:20260615"
},
{
"Date": "2026-06-18",
"Month": 6,
"Day": 18,
"ProductCount": "7件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260618/comiket_deadline_to:20260618"
},
{
"Date": "2026-06-19",
"Month": 6,
"Day": 19,
"ProductCount": "1件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260619/comiket_deadline_to:20260619"
},
{
"Date": "2026-06-22",
"Month": 6,
"Day": 22,
"ProductCount": "1件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260622/comiket_deadline_to:20260622"
},
{
"Date": "2026-06-23",
"Month": 6,
"Day": 23,
"ProductCount": "3件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260623/comiket_deadline_to:20260623"
},
{
"Date": "2026-06-25",
"Month": 6,
"Day": 25,
"ProductCount": "6件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260625/comiket_deadline_to:20260625"
},
{
"Date": "2026-06-26",
"Month": 6,
"Day": 26,
"ProductCount": "18件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260626/comiket_deadline_to:20260626"
},
{
"Date": "2026-06-29",
"Month": 6,
"Day": 29,
"ProductCount": "5件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260629/comiket_deadline_to:20260629"
},
{
"Date": "2026-07-01",
"Month": 7,
"Day": 1,
"ProductCount": "1件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260701/comiket_deadline_to:20260701"
},
{
"Date": "2026-07-02",
"Month": 7,
"Day": 2,
"ProductCount": "38件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260702/comiket_deadline_to:20260702"
},
{
"Date": "2026-07-03",
"Month": 7,
"Day": 3,
"ProductCount": "36件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260703/comiket_deadline_to:20260703"
},
{
"Date": "2026-07-06",
"Month": 7,
"Day": 6,
"ProductCount": "4件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260706/comiket_deadline_to:20260706"
},
{
"Date": "2026-07-07",
"Month": 7,
"Day": 7,
"ProductCount": "7件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260707/comiket_deadline_to:20260707"
},
{
"Date": "2026-07-08",
"Month": 7,
"Day": 8,
"ProductCount": "16件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260708/comiket_deadline_to:20260708"
},
{
"Date": "2026-07-09",
"Month": 7,
"Day": 9,
"ProductCount": "104件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260709/comiket_deadline_to:20260709"
},
{
"Date": "2026-07-10",
"Month": 7,
"Day": 10,
"ProductCount": "110件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260710/comiket_deadline_to:20260710"
},
{
"Date": "2026-07-13",
"Month": 7,
"Day": 13,
"ProductCount": "37件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260713/comiket_deadline_to:20260713"
},
{
"Date": "2026-07-14",
"Month": 7,
"Day": 14,
"ProductCount": "16件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260714/comiket_deadline_to:20260714"
},
{
"Date": "2026-07-15",
"Month": 7,
"Day": 15,
"ProductCount": "12件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260715/comiket_deadline_to:20260715"
},
{
"Date": "2026-07-16",
"Month": 7,
"Day": 16,
"ProductCount": "19件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260716/comiket_deadline_to:20260716"
},
{
"Date": "2026-07-17",
"Month": 7,
"Day": 17,
"ProductCount": "37件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260717/comiket_deadline_to:20260717"
},
{
"Date": "2026-07-21",
"Month": 7,
"Day": 21,
"ProductCount": "89件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260721/comiket_deadline_to:20260721"
},
{
"Date": "2026-07-22",
"Month": 7,
"Day": 22,
"ProductCount": "23件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260722/comiket_deadline_to:20260722"
},
{
"Date": "2026-07-23",
"Month": 7,
"Day": 23,
"ProductCount": "11件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260723/comiket_deadline_to:20260723"
},
{
"Date": "2026-07-24",
"Month": 7,
"Day": 24,
"ProductCount": "7件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260724/comiket_deadline_to:20260724"
},
{
"Date": "2026-07-27",
"Month": 7,
"Day": 27,
"ProductCount": "17件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260727/comiket_deadline_to:20260727"
},
{
"Date": "2026-07-28",
"Month": 7,
"Day": 28,
"ProductCount": "17件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260728/comiket_deadline_to:20260728"
},
{
"Date": "2026-08-03",
"Month": 8,
"Day": 3,
"ProductCount": "2件",
"URL": "https://goods.ryokuyou.co.jp/search/comiket_deadline_from:20260803/comiket_deadline_to:20260803"
}
]
$(document).ready(function () {
var event1 = "2026-08-15";
var event2 = "2026-08-16"; //event1;
var eventname1 = "コミックマーケット108 1日目"; //2日間や3日間イベント時変更 例:"夏コミ1日目";
var eventname2 = "コミックマーケット108 2日目"; //eventname1; //2日間や3日間イベント時変更 例:"夏コミ2日目";
function createMonth(month, year) {
var monthElement = document.createElement("div");
monthElement.className = "dp-month";
monthElement.innerHTML =
"
" + year + "年" + getMonthName(month) + "
";
// Add row for day names
var dayNamesRow = document.createElement("div");
dayNamesRow.className = "dp-day-names";
var dayNames = ["日", "月", "火", "水", "木", "金", "土"];
for (var i = 0; i < 7; i++) {
var dayNameElement = document.createElement("div");
dayNameElement.className = "dp-day-name";
dayNameElement.textContent = dayNames[i];
dayNamesRow.appendChild(dayNameElement);
}
monthElement.appendChild(dayNamesRow);
var daysInMonth = getDaysInMonth(month, year);
var firstDay = new Date(year, month, 1).getDay();
for (var i = 0; i < firstDay; i++) {
monthElement.innerHTML += "";
}
for (var i = 1; i <= daysInMonth; i++) {
var dayElement = document.createElement("div");
dayElement.className = "dp-day";
// dayElement.setAttribute("data-date", new Date(year, month, i).toDateString());
// dayElement.setAttribute("data-date", new Date(year, month, i).toISOString().slice(0, 10));
const tokyoDate = new Date(
new Date(year, month, i).getTime() + 9 * 60 * 60 * 1000
);
dayElement.setAttribute(
"data-date",
tokyoDate.toISOString().slice(0, 10)
);
// Check Saturday or Sunday
if (
new Date(year, month, i).getDay() === 6 ||
new Date(year, month, i).getDay() === 0
) {
dayElement.classList.add("dp-wknd");
}
var dateValue = dayElement.getAttribute("data-date");
// Set event day
if (dateValue === event1 || dateValue === event2) {
// if (dateValue === event1) {
dayElement.classList.remove("dp-wknd");
dayElement.classList.add("dp-event");
// Set the event name based on the matching date
if (dateValue === event1) {
dayElement.title = eventname1;
} else {
dayElement.title = eventname2;
}
}
var holidays = ["2026-07-20", "2026-08-11"];
if (holidays.includes(dayElement.getAttribute("data-date"))) {
dayElement.classList.add("dp-wknd");
}
var currentDate = dayElement.getAttribute("data-date");
var matchingDate = validdates.find(function (item) {
return (
item.Month - 1 === new Date(currentDate).getMonth() &&
item.Day === new Date(currentDate).getDate()
);
});
validdates.forEach(function (item, index) {
var productDate = item.Date;
var productDateObj = new Date(productDate); // Convert productDate string to a Date object
if (isNaN(productDateObj.getTime())) {
console.error("Invalid date format: " + productDate);
return;
}
var today = new Date();
var todayDate = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate()
);
var isDateValid = productDateObj > todayDate;
// console.log("Is date valid for item " + index + ": " + isDateValid);
if (isDateValid) {
var element = document.querySelector(
".dp-day.highlight:nth-child(" + (index + 1) + ")"
);
if (element) {
element.style.opacity = 0.4;
}
}
});
// console.log("matchingDate: " + matchingDate);
if (matchingDate) {
dayElement.classList.add("highlight");
dayElement.title = matchingDate.ProductCount; // show product count on hover
// console.log("data-deadline: ", dataDeadline);
var linkElement = document.createElement("a");
// linkElement.href = "javascript:void(0);";
linkElement.href = matchingDate.url;
linkElement.textContent = i;
var dataDeadline = matchingDate.Date;
linkElement.setAttribute("data-filter", dataDeadline);
dayElement.innerHTML = "";
dayElement.appendChild(linkElement);
} else {
dayElement.textContent = i;
}
// console.log("matchingDate: ", matchingDate);
monthElement.appendChild(dayElement);
}
// Add empty days for the remaining cells in the last row
var lastDay = new Date(year, month, daysInMonth).getDay();
for (var i = lastDay + 1; i < 7; i++) {
monthElement.innerHTML +=
"";
}
return monthElement;
}
function getDayName(day) {
var dayNames = ["日", "月", "火", "水", "木", "金", "土"];
return dayNames[day];
}
function getMonthName(month) {
var monthNames = [
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
];
return monthNames[month];
}
function applyLinkUrls() {
var dayElements = document.getElementsByClassName("dp-day");
for (var i = 0; i < dayElements.length; i++) {
var dayElement = dayElements[i];
var currentDate = dayElement.getAttribute("data-date");
// Check if currentDate is valid
if (currentDate) {
var matchingDate = validdates.find(function (item) {
// Compare the date in the format YYYY-MM-DD
return item.Date === currentDate;
});
if (matchingDate) {
dayElement.classList.add("highlight");
// Create a link element
var linkElement = document.createElement("a");
linkElement.href = matchingDate.URL; // Use the URL from validdates
linkElement.textContent = dayElement.textContent; // Set the link text to the day number
dayElement.innerHTML = ""; // Clear the day element
dayElement.appendChild(linkElement); // Append the link to the day element
}
}
}
}
function getDaysInMonth(month, year) {
return new Date(year, month + 1, 0).getDate();
}
var calendar = document.getElementById("dp-calendar");
var currentDate = new Date();
var currentMonth = currentDate.getMonth();
var currentYear = currentDate.getFullYear();
var months = [];
function createCalendar() {
for (var i = 0; i < monthsahead; i++) {
var month = currentMonth + i;
var year = currentYear;
if (month >= 12) {
month -= 12;
year += 1;
}
var monthElement = createMonth(month, year);
months.push(monthElement);
}
months.forEach(function (month) {
calendar.appendChild(month);
});
applyLinkUrls();
}
createCalendar();
});
document.addEventListener("DOMContentLoaded", function () {
validdates.forEach(function (item) {
var productDate = item.Date;
var productDateObj = new Date(productDate); // Convert productDate string to a Date object
if (isNaN(productDateObj.getTime())) {
console.error("Invalid date format: " + productDate);
return;
}
var now = new Date();
var todayDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
var todayHour = now.getHours();
var isDatePassed = productDateObj < todayDate; // Dates before today
var isToday = productDateObj.getFullYear() === todayDate.getFullYear() &&
productDateObj.getMonth() === todayDate.getMonth() &&
productDateObj.getDate() === todayDate.getDate(); // Compare year, month, and day
// Format the date to match the 'data-date' attribute
var formattedDate = productDateObj.toISOString().split("T")[0];
var element = document.querySelector(
`.dp-day.highlight[data-date="${formattedDate}"]`
);
// Debugging log
console.log({
productDate,
formattedDate,
isDatePassed,
isToday,
todayHour,
elementFound: !!element,
});
if (!element) {
console.error("No element found for date: " + formattedDate);
return;
}
if (isDatePassed) {
// Reduce opacity for past dates
element.style.opacity = 0.4;
} else if (isToday) {
// Check if the hour is past the threshold for today
if (todayHour >= 12) { // Adjusted threshold for testing
element.style.opacity = 0.4; // Apply opacity for today's date
console.log("Styling applied for today's date: ", formattedDate);
}
}
// Future dates (from tomorrow onward) are unaffected
});
});