Skip to content

[Feature]: Culture-dependent DateTime formatting in test reports #5868

Description

@kzrnm

Problem Statement

Timestamp = DateTimeOffset.UtcNow.ToString("dd MMM yyyy, HH:mm:ss 'UTC'"),

Currently, DateTimeOffset.UtcNow.ToString("dd MMM yyyy, HH:mm:ss 'UTC'") is used as a fixed date format.
However, dd MMM yyyy is an English-oriented format and often does not fit other languages well. For example, in Japanese it becomes something like 08 5月 2026, 17:40:20 UTC, which is very unnatural as a Japanese DateTime representation.

If using the "dd MMM yyyy, HH:mm:ss 'UTC'" format, I think InvariantCulture should be specified.

Proposed Solution

Change the places using DateTimeOffset.UtcNow.ToString("dd MMM yyyy, HH:mm:ss 'UTC'") to something like the following.

  • DateTimeOffset.UtcNow.ToString("dd MMM yyyy, HH:mm:ss 'UTC'", CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern, CultureInfo.InvariantCulture)

Alternatives Considered

It might be better to use a culture-dependent format instead. In that case, it would probably make more sense to display the time in local time rather than UTC.

  • DateTimeOffset.Now.ToString(CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern)
  • DateTimeOffset.Now.ToString($"{CultureInfo.InvariantCulture.DateTimeFormat.LongDatePattern} {CultureInfo.InvariantCulture.DateTimeFormat.LongTimePattern}")
  • DateTimeOffset.Now.ToString($"{CultureInfo.InvariantCulture.DateTimeFormat.ShortDatePattern} {CultureInfo.InvariantCulture.DateTimeFormat.LongTimePattern}")

Feature Category

Test Output / Reporting

How important is this feature to you?

None

Additional Context

No response

Contribution

  • I'm willing to submit a pull request for this feature

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions