Files
TPSchedule/mobile/lib/domain/semester.dart
T

13 lines
426 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class Semester {
Semester({required DateTime startDate, required this.totalWeeks})
: startDate = DateTime.utc(startDate.year, startDate.month, startDate.day) {
if (totalWeeks < 1 || totalWeeks > 30) {
throw ArgumentError('学期周数应为 1–30');
}
}
DateTime get firstMonday =>
startDate.subtract(Duration(days: startDate.weekday - 1));
final DateTime startDate;
final int totalWeeks;
}