Navigation
Navigate Navigate Navigate Navigate

IfcValidCalendarDate

Definition from ISO/CD 10303-41:1992: Determines whether the components of a calendar date (IfcCalendarDate) indicate a valid date. If the calendar date is valid, the function returns TRUE, otherwise it returns FALSE.

NOTE Corresponding STEP name: valid_calendar_date, please refer to ISO/IS 10303-41:1994 for the final definition of the formal standard.
HISTORY New function in IFC Release 1.5.1.

EXPRESS specification:

FUNCTION IfcValidCalendarDate
(Date : IfcCalendarDate) : LOGICAL;
IF NOT ({1 <= Date.DayComponent <= 31}) THEN    
  RETURN(FALSE);  
END_IF;
CASE Date.MonthComponent OF
  4         : RETURN({ 1<= Date.DayComponent <= 30});
  6         : RETURN({ 1<= Date.DayComponent <= 30});
  9         : RETURN({ 1<= Date.DayComponent <= 30});
  11        : RETURN({ 1<= Date.DayComponent <= 30});    
  2         :    
  BEGIN
    IF (IfcLeapYear(Date.YearComponent)) THEN
      RETURN({ 1<= Date.DayComponent <= 29});      
    ELSE
      RETURN({ 1<= Date.DayComponent <= 28});      
    END_IF;    
  END;
  OTHERWISE : RETURN(TRUE);  
END_CASE;
END_FUNCTION;