Skip to content

DateTime.ToString() with custom formats is outputting wrong data #855

Closed
nanoframework/CoreLibrary
#159
@josesimoes

Description

@josesimoes

Details about Problem

nanoFramework area: (mscorlib)

Description

Output of DateTime.ToString() with custom formats is wrong on some formats.

Detailed repro steps so we can see the same problem

When reworking Unit Test DateTime_ToStringTest7() got this:

Test DateTime is: 02/28/2430 22:26:20
DateTime.ToString(String) using Custom Formats and Verifying
Testing custom format: 'h:mm:ss.ff t'
Output was '10:26:20.112200 P'

Other suggested things

Expected behavior

  1. Need to revisit the code that's outputting DateTime.ToString().
  2. Unit Tests for DateTime.ToString() need to be improved to perform actual and detailed check of the output, instead of just relying on an output string with any content (currently are checking for output length only).

Sample Project

Screenshot

Additional context

I've made an effort to fix the bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions