Date should be international on OpenIdServerSettings.Edit.cshtml
Describe the bug
<option value="@certificate.ThumbPrint" data-StoreLocation="@certificate.StoreLocation" data-StoreName="@certificate.StoreName" selected="@(selectedCertificate)">
@friendlyName [@certificate.NotBefore.ToString("dd/MM/yy") - @certificate.NotAfter.ToString("dd/MM/yy")] @certificate.Subject
</option>
Orchard Core version
latest main
To Reproduce
Expected behavior
Logs and screenshots
Please highlight what you want to change/changed in the code snippet.
ToString("dd/MM/yy")
That's the current code. What do you want to change it to?
ISO
Thank you. Yours
GUANG ZHENG (Andy)
289-577-8554
On Thu, Sep 11, 2025, 12:10 Zoltán Lehóczky @.***> wrote:
Piedone left a comment (OrchardCMS/OrchardCore#18319) https://github.com/OrchardCMS/OrchardCore/issues/18319#issuecomment-3281654010
That's the current code. What do you want to change it to?
— Reply to this email directly, view it on GitHub https://github.com/OrchardCMS/OrchardCore/issues/18319#issuecomment-3281654010, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACIVS6UFZMIYVQMX4OFLSD3SGNHTAVCNFSM6AAAAACF2DGUW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBRGY2TIMBRGA . You are receiving this because you authored the thread.Message ID: @.***>
We should do what ContentsMeta_SummaryAdmin does:
https://github.com/OrchardCMS/OrchardCore/blob/fe7e2a912ae841614109e5883246278d1ca0fdc2/src/OrchardCore.Modules/OrchardCore.Contents/Views/ContentsMeta_SummaryAdmin.cshtml
IT IS BETTER THAT there is a common ( Extension) method globally.
It's not clear to me why you'd want to use ISO 8601 here (it's purely a GUI thing, so there's no interop/round-trip concern in that case).
@Piedone I'm not even sure what's done in ContentsMeta_SummaryAdmin.cshtml is the right approach.
IMHO, it would be better to just use a well-known format like f or g - or F or G when you need seconds - so that the date can be simply rendered using the rules applicable to the current culture/user locale: https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tostring?view=net-8.0#system-datetime-tostring(system-string-system-iformatprovider)
Don't be confused by the format string here:
https://github.com/OrchardCMS/OrchardCore/blob/fe7e2a912ae841614109e5883246278d1ca0fdc2/src/OrchardCore.Modules/OrchardCore.Contents/Views/ContentsMeta_SummaryAdmin.cshtml#L5
That's not actually affecting the UI display of the TimeSpan. That's handled eventually here: https://github.com/OrchardCMS/OrchardCore/blob/34ae4d8a53b98520d8df6375a8a9161b45c47635/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/DateTimeShapes.cs#L34
Alternatively, we could use the DateTime shape, which does localization:
https://github.com/OrchardCMS/OrchardCore/blob/34ae4d8a53b98520d8df6375a8a9161b45c47635/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/DateTimeShapes.cs#L117
Don't be confused by the format string here:
Haha, yeah, I definitely got confused: it's indeed only used for the datetime attribute of the <time> node, for which an ISO-formatted date is the best (in that case, o could be used to avoid the manual format).
I filed this issue since this is related.
I suggest we use a localized "format" in this cshtml since the DateTime shape would only be able to render it with the long date time.
@friendlyName [@certificate.NotBefore.ToString(S["dd/MM/yy"]) - @certificate.NotAfter.ToString(S["dd/MM/yy"])] @certificate.Subject
Note that LocalizedString has a default conversion to string by returning the .Value.
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).
This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.