From b5a5e6fbe46bedff07110f30441f148283cb6c7e Mon Sep 17 00:00:00 2001 From: Samuel Moriyasu Date: Wed, 6 Dec 2023 21:51:17 +1300 Subject: [PATCH] Fix CurrentValueView displaying selected date range wrong when using a custom calendar. --- Sources/Views/CurrentValueView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Views/CurrentValueView.swift b/Sources/Views/CurrentValueView.swift index f731717..33f64bb 100644 --- a/Sources/Views/CurrentValueView.swift +++ b/Sources/Views/CurrentValueView.swift @@ -52,6 +52,7 @@ final class CurrentValueView: UIView { formatter.locale = self.calendar.locale formatter.dateFormat = self.config.format formatter.calendar = self.calendar + formatter.timeZone = self.calendar.timeZone return formatter }() @@ -127,7 +128,7 @@ final class CurrentValueView: UIView { self.clearButton.alpha = 1 self.clearButton.isUserInteractionEnabled = true - if value.onSameDay { + if value.fromDate.isInSameDay(in: self.calendar ,date: value.toDate) { self.label.text = self.dateFormatter.string(from: value.fromDate) } else { self.label.text = self.dateFormatter.string(from: value.fromDate) + " – " + self.dateFormatter.string(from: value.toDate)