Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ios/RNDateTimePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ - (void)setMinuteInterval:(NSInteger)minuteInterval
_reactMinuteInterval = minuteInterval;
}

- (void)setTimeZone:(NSTimeZone *)timeZone
{
// A loaded calendar keeps its visible month across a time zone change. With a minimum/maximum date
// near a month boundary that month can fall outside the range in the new zone, and UIKit throws
// (e.g. "Trying to scroll to a month marked as visible that is not loaded."). Clearing the range
// while the zone changes avoids that; restoring it re-applies the limits in the new zone.
NSDate *minimumDate = self.minimumDate;
NSDate *maximumDate = self.maximumDate;
self.minimumDate = nil;
self.maximumDate = nil;
[super setTimeZone:timeZone];
self.minimumDate = minimumDate;
self.maximumDate = maximumDate;
}

- (void)setDate:(NSDate *)date {
// Need to avoid the case where values coming back through the bridge trigger a new valueChanged event
if (![self.date isEqualToDate:date]) {
Expand Down