Quintiq file version 2.0
#parent: #root
Method GetWeekOfMonthAndDayOfWeek (
  Date date_i,
  output String weekOfMonth_o,
  output String dayOfWeek_o
) id:Method_LibCal_dlgEvent_GetWeekOfMonthAndDayOfWeek
{
  #keys: '[131094.0.2098819379]'
  Body:
  [*
    // This logic is used by both "Monthly" and "Yearly".
    
    rowSeparator := ";";  // ssMonthlyPatternWeekOfMonth.RowSeparator() in not possible (yet?) in WC.
    
    // Determine the occurrence of the day (i.e. the week) within the month.
    occurrenceOfDay := ( date_i.Day() - 1 ) div 7;
    
    weeks         := Translations::Pattern_WeekOfMonth().Tokenize( rowSeparator );
    weekOfMonth_o := weeks.Element( occurrenceOfDay );
    
    // Determine the day of the week.
    days        := Translations::Pattern_Days().Tokenize( rowSeparator );
    dayOfWeek_o := days.Element( date_i.DayOfWeek() - 1 );
  *]
}
