Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit bca6f23

Browse files
authored
Fixed date formatter issue with different timezone (#13634) fixes #13366
1 parent 25b2aa4 commit bca6f23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,12 @@ void UpdateDateFromModel(bool animate)
168168
if (_picker.Date.ToDateTime().Date != Element.Date.Date)
169169
_picker.SetDate(Element.Date.ToNSDate(), animate);
170170

171-
//can't use Element.Format because it won't display the correct format if the region and language are set differently
172-
if (String.IsNullOrWhiteSpace(Element.Format) || Element.Format.Equals("d") || Element.Format.Equals("D"))
171+
// Can't use Element.Format because it won't display the correct format if the region and language are set differently
172+
if (string.IsNullOrWhiteSpace(Element.Format) || Element.Format.Equals("d") || Element.Format.Equals("D"))
173173
{
174174
NSDateFormatter dateFormatter = new NSDateFormatter();
175+
dateFormatter.TimeZone = NSTimeZone.FromGMT(0);
176+
175177
if (Element.Format?.Equals("D") == true)
176178
{
177179
dateFormatter.DateStyle = NSDateFormatterStyle.Long;

0 commit comments

Comments
 (0)