Incorrect Date Format when setting the culture

Stimulsoft Reports.NET discussion
EthanB
Posts: 9
Joined: Wed May 15, 2024 3:35 am

Incorrect Date Format when setting the culture

Post by EthanB »

I tested this case in the Report Designer. When I changed the culture, the date format applied correctly according to the selected culture. However, when I set the culture for this report in Stimulsoft.Dashboards.Web.NetCore using the sample code:

var report = new StiReport();
if (Template != null)
report.Load(Template);
report.Culture = "en-GB";
var test = new System.Globalization.CultureInfo(report.Culture);
report.GlobalizationManager.Culture = test;
the date format in the designer shows:
11 January 2024

but when I export it using .NET Core, the date format is:
Thursday, 11 January 2024
Lech Kulikowski
Posts: 6812
Joined: Tue Mar 20, 2018 5:34 am

Re: Incorrect Date Format when setting the culture

Post by Lech Kulikowski »

Hello,

Please check the last release build.
If the issue is still present, please send us a sample report with test data for analysis.

Thank you.
EthanB
Posts: 9
Joined: Wed May 15, 2024 3:35 am

Re: Incorrect Date Format when setting the culture

Post by EthanB »

I have updated to a new version and tested it, but the issue still occurs.
This is the format to view the date: MRT.

Code: Select all

{
  "ReportGuid": "601e20ed4e8309799153ba4a76772c82",
  "ReportName": "Ethan test DatePicker 22052024",
  "ReportAlias": "Ethan test DatePicker 22052024",
  "ReportFile": "Ethan test DatePicker 22052024.mrt",
  "ReportCreated": "/Date(0+0800)/",
  "ReportChanged": "/Date(1716360170000+0700)/",
  "EngineVersion": "EngineV2",
  "CalculationMode": "Interpretation",
  "ReportUnit": "Inches",
  "Culture": "en-GB",
  "PreviewSettings": 268435455,
  "Dictionary": {
    "Variables": {
      "0": {
        "Value": "%0d%0a",
        "Name": "NewLine",
        "Alias": "NewLine",
        "Type": "System.String"
      }
    },
    "DataSources": {
      "0": {
        "Ident": "StiDataTableSource",
        "Name": "Table1",
        "Alias": "Table1",
        "Key": "f2a1b7e53f7e40abadb30be3fbcbccd7",
        "Columns": {
          "0": {
            "Name": "question1",
            "Index": -1,
            "NameInSource": "question1",
            "Alias": "question1",
            "Type": "System.DateTime"
          },
          "1": {
            "Name": "FormDate",
            "Index": -1,
            "NameInSource": "FormDate",
            "Alias": "FormDate",
            "Type": "System.String"
          },
          "2": {
            "Name": "1 question2",
            "Index": -1,
            "NameInSource": "1 question2",
            "Alias": "1 question2",
            "Type": "System.String"
          }
        },
        "NameInSource": "Ethantest.Table1"
      }
    }
  },
  "Pages": {
    "0": {
      "Ident": "StiPage",
      "Name": "Page1",
      "Guid": "a51fcc4185d448199d1954bcf970608b",
      "Interaction": {
        "Ident": "StiInteraction"
      },
      "Border": ";;2;;;;;solid:Black",
      "Brush": "solid:",
      "Components": {
        "0": {
          "Ident": "StiText",
          "Name": "Text2",
          "Guid": "01b8733cd01099eaf7f6a1a9b13f6afb",
          "ClientRectangle": "1.5,1.5,1.2,0.2",
          "Interaction": {
            "Ident": "StiInteraction"
          },
          "Text": {
            "Value": "{Table1.question1}"
          },
          "Border": ";;;;;;;solid:Black",
          "Brush": "solid:",
          "TextBrush": "solid:Black",
          "TextFormat": {
            "Ident": "StiDateFormatService",
            "StringFormat": "D"
          }
        },
        "1": {
          "Ident": "StiText",
          "Name": "Text1",
          "Guid": "ec667e73def2771b0a40c4b998b5b3af",
          "ClientRectangle": "1.3,2.3,1.2,0.2",
          "Interaction": {
            "Ident": "StiInteraction"
          },
          "Text": {
            "Value": "{Table1.n1_question2}"
          },
          "Border": ";;;;;;;solid:Black",
          "Brush": "solid:",
          "TextBrush": "solid:Black"
        }
      },
      "PaperSize": "Letter",
      "PageWidth": 8.5,
      "PageHeight": 11,
      "Watermark": {
        "TextBrush": "solid:50,0,0,0"
      },
      "Margins": {
        "Left": 0.39,
        "Right": 0.39,
        "Top": 0.39,
        "Bottom": 0.39
      }
    }
  }
}
image1.png
image1.png (20.57 KiB) Viewed 2616 times
Lech Kulikowski
Posts: 6812
Joined: Tue Mar 20, 2018 5:34 am

Re: Incorrect Date Format when setting the culture

Post by Lech Kulikowski »

Hello,

Please send test data for your report.

Thank you.
EthanB
Posts: 9
Joined: Wed May 15, 2024 3:35 am

Re: Incorrect Date Format when setting the culture

Post by EthanB »

This is a test data:
{"Table1":[{"question1":"5/8/2024 6:30:03 AM","1.question2":"Ethan test","FormDate":"22/05/2024 13:30"}]}
Lech Kulikowski
Posts: 6812
Joined: Tue Mar 20, 2018 5:34 am

Re: Incorrect Date Format when setting the culture

Post by Lech Kulikowski »

Hello,

We need some time to investigate the issue. We will let you know about the result.

Thank you.
Lech Kulikowski
Posts: 6812
Joined: Tue Mar 20, 2018 5:34 am

Re: Incorrect Date Format when setting the culture

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue. What localization, language is set in your system, browser?

Thank you.
EthanB
Posts: 9
Joined: Wed May 15, 2024 3:35 am

Re: Incorrect Date Format when setting the culture

Post by EthanB »

Laguage is English, Country: UK, "Culture": "en-GB". Can you share with me the file you downloaded with the same data? And MRT?
Lech Kulikowski
Posts: 6812
Joined: Tue Mar 20, 2018 5:34 am

Re: Incorrect Date Format when setting the culture

Post by Lech Kulikowski »

Hello,

Please check the attached report.

Thank you.
Attachments
1.mrt
(5.23 KiB) Downloaded 156 times
EthanB
Posts: 9
Joined: Wed May 15, 2024 3:35 am

Re: Incorrect Date Format when setting the culture

Post by EthanB »

I have checked this MRT file and observed that the culture in this report is set to 'de-DE'. I can test it in the Stimulsoft demo, as shown in the video attachments. However, when I set 'en-GB' it in Stimulsoft using the same MRT file exported by the designer, which I sent to you, it only shows data in the 'en-US' format, such as 'Tuesday, April 14, 2020'.
Attachments
Video_2024-06-03_104203.mp4
(6.13 MiB) Downloaded 155 times
Post Reply