Skip to content

Commit

Permalink
fix(recurrence): work with MS values
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jun 30, 2023
1 parent 0eed0df commit 806aec2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: office365
version: 1.21.0
version: 1.21.1

crystal: ">= 0.36.1"

Expand Down
6 changes: 4 additions & 2 deletions src/models/patterned_recurrence.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ class Office365::PatternedRecurrence
RecurrencePattern.new(Office365::RecurrencePatternType::Daily, recurrence.interval)
when "weekly"
RecurrencePattern.new(Office365::RecurrencePatternType::Weekly, recurrence.interval, days_of_week, recurrence.first_day_of_week || Office365::DayOfWeek::Sunday)
when "monthly"
RecurrencePattern.new(Office365::RecurrencePatternType::RelativeMonthly, recurrence.interval, days_of_week)
when "relativeMonthly", "monthly"
RecurrencePattern.new(Office365::RecurrencePatternType::RelativeMonthly, recurrence.interval, days_of_week, index: recurrence.index)
when "absoluteMonthly"
RecurrencePattern.new(Office365::RecurrencePatternType::AbsoluteMonthly, recurrence.interval, day_of_month: recurrence.day_of_month)
end
range = RecurrenceRange.new("endDate", recurrence_start_date.to_s("%F"), recurrence.range_end.to_s("%F"))

Expand Down
3 changes: 2 additions & 1 deletion src/models/recurrence_param.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ module Office365
property range_end : Time
property interval : Int32?
property index : WeekIndex?
property day_of_month : Int32?
property days_of_week : Array(String)
property first_day_of_week : Office365::DayOfWeek?

def initialize(@pattern : String, @range_end : Time, @interval : Int32? = 1, @days_of_week : Array(String) = [] of String, first_day_of_week : String? = nil, @index : WeekIndex? = nil)
def initialize(@pattern : String, @range_end : Time, @interval : Int32? = 1, @days_of_week : Array(String) = [] of String, first_day_of_week : String? = nil, @index : WeekIndex? = nil, @day_of_month = nil)
@first_day_of_week = first_day_of_week ? Office365::DayOfWeek.parse(first_day_of_week) : Office365::DayOfWeek::Sunday
end
end
Expand Down
8 changes: 1 addition & 7 deletions src/models/recurrence_pattern.cr
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ module Office365
property month : Int32?
property type : RecurrencePatternType?

def initialize(@type, @interval)
end

def initialize(@type, @interval, @days_of_week)
end

def initialize(@type, @interval, @days_of_week, @first_day_of_week)
def initialize(@type, @interval = nil, @days_of_week = nil, @first_day_of_week = nil, @day_of_month = nil, @index = nil, @month = nil)
end
end
end

0 comments on commit 806aec2

Please sign in to comment.