[+] Encapsulate getTerm(date)

This commit is contained in:
Hykilpikonna
2019-12-07 13:47:35 -05:00
parent 16e7e408bc
commit 3e37ab15fc
+10
View File
@@ -68,4 +68,14 @@ export default class Constants
new Date('Jun 05 2020'),
];
public static CURRENT_TERM = findLastIndex(Constants.TERMS, d => d < new Date());
/**
* Find out the specified date is in which term
*
* @param date
*/
static getTerm(date: Date)
{
return findLastIndex(Constants.TERMS, d => d <= date);
}
}