getTimeFormat static method
Implementation
static String getTimeFormat(int timeType, DateTime currentTime) {
switch (timeType) {
// 天
case 2:
return formatDate(currentTime, [yyyy, "-", mm, "-", dd]);
// 月
case 3:
return formatDate(currentTime, [
yyyy,
"-",
mm,
]);
// 年
case 4:
return formatDate(currentTime, [yyyy]);
// 周
case 5:
int offset = currentTime.weekday - DateTime.monday;
DateTime weekDay = currentTime.subtract(Duration(days: offset));
return formatDate(weekDay, [yyyy, "-", mm, "-", dd]);
default:
return "";
}
}