Class DateUtility
java.lang.Object
com.omarigrant.budget.utilities.date.DateUtility
This is a class that assists in date functions in the application,
such as getting all future dates that occur in a given frequency.
- Author:
- Omari Grant
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcountDateOccurencesUntilEndDate(DateUtilityDTO dateUtilityDTO) This function counts how many dates there are until the end date.getAllDateOccurences(DateUtilityDTO dateUtilityDTO) All dates that occur after the current date, given a frequency and start date.getNextDateOccurence(DateUtilityDTO dateUtilityDTO) This function will return the next date to occur after the currentLocalDate and from the start date occur every frequency given and before the end date.
-
Constructor Details
-
DateUtility
- Parameters:
currentDate- The date to use as a base. For example all future dates are dates occuring on or after this date.
-
-
Method Details
-
getNextDateOccurence
This function will return the next date to occur after the currentLocalDate and from the start date occur every frequency given and before the end date.- Parameters:
dateUtilityDTO- The DateUtilityDTO model- Returns:
- The next date that will occur, given a start date, end date and current date to check from, given a frequency.
-
getAllDateOccurences
All dates that occur after the current date, given a frequency and start date. Limit result to allow for saving in a database.- Parameters:
dateUtilityDTO- The DateUtilityDTO model- Returns:
- A list of dates
-
countDateOccurencesUntilEndDate
This function counts how many dates there are until the end date.- Parameters:
dateUtilityDTO- The DateUtilityDTO model- Returns:
- a number specifying how many occurences there are until end date
-