cashier_reserve_app/lib/home/reserve_view_model.dart

36 lines
859 B
Dart

import 'package:cashier_reserve/common/base/ui_model.dart';
class ReserveViewModel extends BaseUIModel {
Map<int, String> weekdayMap = {
1: "星期一",
2: "星期二",
3: "星期三",
4: "星期四",
5: "星期五",
6: "星期六",
7: "星期日",
};
Map<int, String> dayInfoMap = {
0: "",
1: "",
2: "",
};
String getCurrentDate() {
DateTime now = DateTime.now();
return "${now.year}/${now.month}/${now.day}";
}
String getOffsetDay(int offset) {
DateTime now = DateTime.now();
DateTime offsetDay = now.add(Duration(days: offset));
return "${dayInfoMap[offset]}/${offsetDay.day}";
}
String getOffsetWeekday(int offset) {
DateTime now = DateTime.now();
DateTime offsetDay = now.add(Duration(days: offset));
return weekdayMap[offsetDay.weekday] ?? "";
}
}