diff --git a/StatementParser/StatementParserCLI/Output.cs b/StatementParser/StatementParserCLI/Output.cs index 0c2c09b..bdc2eb1 100644 --- a/StatementParser/StatementParserCLI/Output.cs +++ b/StatementParser/StatementParserCLI/Output.cs @@ -70,7 +70,14 @@ private void SetRowValues(IRow row, ICollection rowValues) { var cell = row.CreateCell(columnIndex); - cell.SetCellValue(rowValue); + if(DateTime.TryParse(rowValue, out var dateValue)) + { + cell.SetCellValue(dateValue.ToString("s")); + } + else + { + cell.SetCellValue(rowValue); + } columnIndex++; } diff --git a/StatementParser/TaxReporterCLI/Output.cs b/StatementParser/TaxReporterCLI/Output.cs index 4b78c83..1bbac4a 100644 --- a/StatementParser/TaxReporterCLI/Output.cs +++ b/StatementParser/TaxReporterCLI/Output.cs @@ -82,6 +82,11 @@ private IRow CreateRow(ISheet sheet, int rowIndex, IList rowValues) { cell.SetCellValue((double)value); } + //For dates using the sortable format so excel can treat it better or at least sort as a string + else if(DateTime.TryParse(rowValue, out var dateValue)) + { + cell.SetCellValue(dateValue.ToString("s")); + } else { cell.SetCellValue(rowValue);