Open tombly opened 1 year ago
@jonathanpeppers Ideas?
https://github.com/drasticactions/MauiRepros/tree/main/MauiShortDateTime https://github.com/drasticactions/MauiRepros/tree/main/AndroidShortDateTime
Trying in both a .NET Android and MAUI app, running on .NET 8 with API 34, I couldn't repro this behavior. It seems to work fine in all cases in the simulator and devices I have that can run API 34.
ToShortTimeString
is a ToString("t")
and is in the runtime. The literal string should have a space in it still. If it's rendering different in your app, maybe it has to do with something you have setup in your app? Maybe create a repro project showing it? Or try running mine and see if they show for you?
Also, I believe API 34 is .NET 8.0 only? You selected "Version with bug" with net7.0, was that mistaken?
Hi @tombly. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Hi @drasticactions. Thanks for taking a look at this. We're using Visual Studio Mac so we're still on .NET 7 (and targeting Android API 33) and running the app on an API 34 device. I also tried targeting API 34, so maybe this issue is specific to .NET 7?
@tombly maybe you can reproduce the issue in a dotnet new android
app and share it? If this is BCL, we probably will need someone on the Mono team to take a look.
Hi @tombly. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Hi @tombly. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@jonathanpeppers Here's a simple project that demonstrates the issue (includes a screenshot): https://github.com/tombly/shared/tree/main/AndroidTimeFormatIssue
For some reason dotnet new android
doesn't work for me, so I just used Visual Studio 2022 (Windows) to create a new "Android Application" project, added 2 lines to the MainActivity.cs file and then ran the app on API 33 and 34 emulators. Thanks!
/cc @steveisok looks like there is a difference between Android 33 & 34 with DateTime.Now
, see screenshot:
https://github.com/tombly/shared/blob/main/AndroidTimeFormatIssue/Screenshot.png
.... does android update its ICU libraries during API changes? I'm asking because net core gets its localization data (including time format strings) from the host OS, and ICU updates multiple times a year. There have been changes to how we parse certain types of input when reading the format strings, including certain types of spaces; see https://github.com/dotnet/runtime/issues/83571 for a related example.
That aside, barring certain extremely specific edge cases, you shouldn't care about or pay attention to the actual formatted value; eg, in tests you should almost never test that the output string ends up a certain way (other than "not empty").
Tagging subscribers to 'arch-android': @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.
Author: | tombly |
---|---|
Assignees: | mdh1418 |
Labels: | `os-android`, `area-CoreLib-mono` |
Milestone: | - |
Description
In Android 14 (API 34) the
DateTime.Now.ToShortTimeString()
method no longer includes a space between the time and the am/pm. For example:API 34:
API 33:
Steps to Reproduce
dotnet new maui
DateTime.Now.ToShortTimeString()
and display the output in the UI.Expected: Short time string should have a space between the time and the am/pm. Actual: There is no space between the time and the am/pm.
Link to public reproduction project repository
No response
Version with bug
7.0.92
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 14 (API 34)
Did you find any workaround?
No response
Relevant log output
No response