Class EventHelper

    • Method Detail

      • isBetween

        public static boolean isBetween​(String dateStr,
                                        String startStr,
                                        String endStr)
        Tests if the given date is either: - equal to the first, if there is no end date. - between the two dates, if there is a start and end date.
        Parameters:
        dateStr - the date to test.
        startStr - start of the interval.
        endStr - end of the interval.
        Returns:
        true if the date is either equal to the start date or between the start and end date.
      • inMonth

        public static boolean inMonth​(String monthStartStr,
                                      String eventStartStr,
                                      String eventEndStr)
        Tests if the given event occurs in the given month.
        Parameters:
        monthStartStr - The month first day, cannot be null or blank.
        eventStartStr - The event start date, can be null or blank only if the end date is set.
        eventEndStr - The event end date, can be null or blank only if the end date is set.
        Returns:
        true if the event occurs in the given month.
      • _contains

        private static boolean _contains​(ZonedDateTime start,
                                         ZonedDateTime end,
                                         ZonedDateTime event)
        Test if an event is between 2 dates
        Parameters:
        start - start date
        end - end date
        event - event to check
        Returns:
        true if the event is between both dates
      • _overlaps

        private static boolean _overlaps​(ZonedDateTime start1,
                                         ZonedDateTime end1,
                                         ZonedDateTime start2,
                                         ZonedDateTime end2)
        Test if 2 period of time overlap
        Parameters:
        start1 - start of 1st period
        end1 - end of 1st period
        start2 - start of 2nd period
        end2 - end of 2nd period
        Returns:
        true if both period overlaps
      • nextDay

        public static String nextDay​(String dateStr)
        Tests if the given date is either:
        Parameters:
        dateStr - the date to test.
        Returns:
        true if the date is either equal to the start date or between the start and end date.
      • nextDay

        public static String nextDay​(String dateStr,
                                     String format)
        Tests if the given date is either:
        Parameters:
        dateStr - the date to test.
        format - the format ("date" or "basicDate").
        Returns:
        true if the date is either equal to the start date or between the start and end date.
      • isDatetime

        public static boolean isDatetime​(String contentId,
                                         String attributeName)
        Tests if the given attribute for the given content is of type datetime
        Parameters:
        contentId - The id of the content
        attributeName - The attribute name
        Returns:
        true if the given attribute for the given content is of type datetime