diff --git a/src/constants.ts b/src/constants.ts index bf984fe..26b5b94 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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); + } }