microsoft / Analysis-Services

Git repo for Analysis Services samples and community projects
MIT License
597 stars 415 forks source link

BPARules: Date rules should be ISO 8601 compliant #181

Open bgarcevic opened 1 year ago

bgarcevic commented 1 year ago

The date formatting rules changes the dates to mm/dd/yyyy whereas which is only used in the US. All other countries use either dd/mm/yyyy or ISO 8601 yyyy-mm-dd or some variation thereof.

m-kovalsky commented 1 year ago

This was brought up in Issue #135. If you want this to be of another date format, I recommend updating your rules file (the fix expression) to use the date format you desire.

bgarcevic commented 1 year ago

If I made a danish translation of the project, to this repo, could I change the date format?

m-kovalsky commented 1 year ago

I do not believe that a Danish translation is necessary. There are 2 options:

  1. Updating the fix expression for this rule within the BPARules.json file after you download it.
  2. Running the following C# script in Tabular Editor (changing the parameter in the first line as desired).
string dateFormat = "dd/mm/yyyy"; // Enter the desired date format 

foreach (var c in Model.AllColumns.Where(a => a.DataType == DataType.DateTime && a.Name.IndexOf("Date", StringComparison.OrdinalIgnoreCase) >= 0))
{
    c.FormatString = dateFormat;
}