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

[iOS] Add consistency in date format between platforms #14573

Merged
merged 1 commit into from
Dec 23, 2021
Merged

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Add consistency in date format between platforms.

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

Launch Core Gallery and navigate to the sample 13918. If can see the century in the DatePicker, the test has passed.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

{
NSDateFormatter dateFormatter = new NSDateFormatter();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Android we are using the following code:

if (String.IsNullOrWhiteSpace(Element.Format))
{
    EditText.Text = date.ToShortDateString();
}
else if (Element.Format.Contains('/'))
{
    EditText.Text = date.ToString(Element.Format, CultureInfo.InvariantCulture);
}
else
{
    EditText.Text = date.ToString(Element.Format);
}

The default template is "d", and for that reason using NSDateFormatter with Short DateStyle the format is: "MM/dd/yy". In this PR we adapt iOS code to the other platforms.

@jfversluis jfversluis merged commit 4c8f3f2 into 5.0.0 Dec 23, 2021
@jfversluis jfversluis deleted the fix-13918 branch December 23, 2021 14:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] iOS DatePicker only displays the last two digits of the year
2 participants