updated getMonthValue in DayCalculator to use Months class
This commit is contained in:
parent
d78746fa87
commit
0de095167e
1 changed files with 3 additions and 38 deletions
|
@ -1,6 +1,8 @@
|
|||
// Based on this article:
|
||||
// https://artofmemory.com/blog/how-to-calculate-the-day-of-the-week-4203.html
|
||||
|
||||
import 'Months.dart';
|
||||
|
||||
class DayCalculator {
|
||||
// Calculates (YY + floor(YY / 4)) % 7
|
||||
static int getYearValue(int year){
|
||||
|
@ -10,44 +12,7 @@ class DayCalculator {
|
|||
|
||||
static int getMonthValue(int month){
|
||||
// Returns the month value for input 0-11
|
||||
switch(month){
|
||||
case 0:{
|
||||
return 0;
|
||||
}
|
||||
case 1:{
|
||||
return 3;
|
||||
}
|
||||
case 2:{
|
||||
return 3;
|
||||
}
|
||||
case 3:{
|
||||
return 6;
|
||||
}
|
||||
case 4:{
|
||||
return 1;
|
||||
}
|
||||
case 5:{
|
||||
return 4;
|
||||
}
|
||||
case 6:{
|
||||
return 6;
|
||||
}
|
||||
case 7:{
|
||||
return 2;
|
||||
}
|
||||
case 8:{
|
||||
return 5;
|
||||
}
|
||||
case 9:{
|
||||
return 0;
|
||||
}
|
||||
case 10:{
|
||||
return 3;
|
||||
}
|
||||
default:{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
return Months.getFromInt(month).value;
|
||||
}
|
||||
|
||||
static int getMonthValueByString(String month){
|
||||
|
|
Loading…
Add table
Reference in a new issue