Skip to content

Commit

Permalink
Merge pull request #963 from bcgov/bugfix/AB#27292-datagrid-datetime-…
Browse files Browse the repository at this point in the history
…presentation

AB#27292 use explicit formatting for datagrid datetime column
  • Loading branch information
samsaravillo authored Dec 31, 2024
2 parents 35f4d80 + 954ce0a commit f66523b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,17 @@ var ct when IsCheckBoxColumn(ct) => ValueConverterHelpers.ConvertCheckbox(value)
};
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Style",
"IDE0060:Remove unused parameter",
Justification = "We ignore the format provided from CHEFS for datetime as this does not display correctly")]
private static bool TryParseDateTime(string value, string? format, out string formattedDateTime)
{
const string fixedFormat = "yyyy-MM-dd hh:mm:ss tt";
if (DateTime.TryParse(value, new CultureInfo("en-CA"), DateTimeStyles.None, out DateTime dateTime))
{
var appliedFormat = !string.IsNullOrEmpty(format) ? format : "yyyy-MM-dd hh:mm:ss tt";
// The format that CHEFS provides vs the provided value don't format correctly
format = fixedFormat;
var appliedFormat = !string.IsNullOrEmpty(format) ? format : fixedFormat;
formattedDateTime = dateTime.ToString(appliedFormat, CultureInfo.InvariantCulture);
return true;
}
Expand Down

0 comments on commit f66523b

Please sign in to comment.