0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GAS】毎月1日の「釜揚げうどんの日」が土日祝と重なる日をGoogleカレンダーに自動登録してみた

0
Last updated at Posted at 2026-09-30

44366ac8-9683-4644-9e4f-fdc8c58520f7.jfif

はじめに

毎月1日といえば丸亀製麺の「釜揚げうどんの日」。ですが、平日だとどうしても仕事やタスクに追われて店舗へ駆け込むのが難しいエンジニアも多いはずです。

「もし1日が土日祝と重なれば、心置きなく並・大・特を堪能できる最強の休日になるのでは……?」

そんなうどん好きのエンジニア的発想から、現在から2100年までの毎月1日を走査し、土日祝と被る「釜揚げうどんの日」だけをGoogleカレンダーに自動で拾い上げるGAS(Google Apps Script)を作成してみました。


開発したコード

土日判定と祝日カレンダーのAPIを組み合わせ、条件に一致する日だけにイベントを生成します。

function createFirstDayEvents() {
  const targetCalendarId = 'YOUR_CALENDAR_ID@group.calendar.google.com';
  const holidayCalendarId = 'ja.japanese#holiday@group.v.calendar.google.com';
  
  const targetCalendar = CalendarApp.getCalendarById(targetCalendarId);
  const holidayCalendar = CalendarApp.getCalendarById(holidayCalendarId);
  
  const startYear = new Date().getFullYear();
  const endYear = 2100;
  
  console.log("丸亀製麺の釜揚げうどんの日(土日祝)の抽出処理を開始します...");

  for (let year = startYear; year <= endYear; year++) {
    for (let month = 0; month < 12; month++) {
      let date = new Date(year, month, 1);
      
      let dayOfWeek = date.getDay();
      let isWeekend = (dayOfWeek === 0 || dayOfWeek === 6);
      
      let holidays = holidayCalendar.getEventsForDay(date);
      let isHoliday = (holidays.length > 0);
      
      if (isWeekend || isHoliday) {
        let title = "【丸亀製麺】釜揚げうどんの日(土日祝)";
        if (isHoliday) {
          title += " - " + holidays[0].getTitle();
        }
        
        targetCalendar.createAllDayEvent(title, date);
        console.log(`登録済み: ${year}/${month + 1}/1 (${isHoliday ? '祝日' : '土日'})`);
      }
    }
  }
  
  console.log("すべての処理が完了しました。");
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?