Skip to content

AM/PM doesn't use culture #45

@jahav

Description

@jahav

Hi @andersnm,

thank you for the library. I am using it over at ClosedXML. There is a small issue with AM/PM designators. It seems that AM/PM designator isn;t formatted into a culture-aware strings. As an example, for Czech language it should use

  • odp. instead of AM (odpoledne in Czech)
  • dop. instead of PM (dopoledne in Czech)

Image

I believe it should be enough to modify a line in the FormatDate method to use passed culture instead of invariant one (Formatter.cs#L255):
var ampm = date.ToString("tt", CultureInfo.InvariantCulture);

.NET is already aware of these conventions and formats it correctly for tt format string (plus it's stored in CultureInfo.DateTimeFormat.AMDesignator and DateTimeFormat.PMDesignator).

It seems that same should not apply to the A/P. It seems that Excel always keeps a or p, regardless of a region.

Image

I can make a PR if you are willing to merge it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions