Class DateUtility

java.lang.Object
com.omarigrant.budget.utilities.date.DateUtility

public class DateUtility extends Object
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 Details

    • DateUtility

      public DateUtility(LocalDate currentDate)
      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

      public LocalDate 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.
      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

      public List<LocalDate> getAllDateOccurences(DateUtilityDTO dateUtilityDTO)
      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

      public int countDateOccurencesUntilEndDate(DateUtilityDTO dateUtilityDTO)
      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