File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,18 @@ import { getCurrentYearMonth, downloadICS } from "./utils.js";
33function initializeInputs ( ) {
44 const { year, month } = getCurrentYearMonth ( ) ;
55 document . getElementById ( "yearInput" ) . value = year ;
6+ // set year max to year + 1
7+ document . getElementById ( "yearInput" ) . max = year + 1 ;
68 document . getElementById ( "monthInput" ) . value = month ;
79}
810
911async function fetchCalendarData ( sesskey ) {
1012 const year = parseInt ( document . getElementById ( "yearInput" ) . value ) ;
1113 const month = parseInt ( document . getElementById ( "monthInput" ) . value ) ;
14+ if ( month < 1 || month > 12 ) {
15+ console . error ( "Invalid month value:" , month ) ;
16+ return ;
17+ }
1218 // day is dont care
1319 const day = 1 ;
1420
Original file line number Diff line number Diff line change @@ -11,13 +11,16 @@ <h1 class="text-xl font-bold">Moodle Calendar</h1>
1111 < input
1212 type ="number "
1313 id ="yearInput "
14+ min ="1992 "
1415 class ="w-20 px-2 py-1 text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-violet-500 "
1516 placeholder ="年 "
1617 />
1718 < span class ="text-gray-700 "> 年</ span >
1819 < input
1920 type ="number "
2021 id ="monthInput "
22+ min ="1 "
23+ max ="12 "
2124 class ="w-16 px-2 py-1 text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-violet-500 "
2225 placeholder ="月 "
2326 />
You can’t perform that action at this time.
0 commit comments