我正在为我的大学时间表网站构建一个API。默认选项是查找今天的时间表。然而,时间表系统使用的周数不同于我们通常使用的周数。
构建URL需要的两件事之一是周数。
TIMETABLE_URL = 'http://timetable.ait.ie/reporting/textspreadsheet;student+set;id;{}?t=student+set+textspreadsheet&days=1-5&=&periods=3-20&=student+set+textspreadsheet&weeks={}&template=student+set+textspreadsheet'
周编号应从此日期开始:
27 Aug 2018 - 2 Sep 2018
. 在此之后,
week 2
将是
3 Sep 2018-9 Sep 2018
等等。这应该延续到新的一年,
31 Dec 2018-6 Jan 2019
将是
week 19
. 今年总共有52周。
我知道如何检查某个日期是否在上面的某个范围之间,但我希望避免手动设置所有日期范围。我怎么能让一个剧本知道,例如,它在9月12日的第3周?