telerik / kendo-angular

Issue tracker - Kendo UI for Angular
http://www.telerik.com/kendo-angular-ui/
Other
469 stars 218 forks source link

[Spreadsheet] Format property is not applied for dates #4333

Open georgi-sla opened 4 months ago

georgi-sla commented 4 months ago

Describe the bug Currently, when the user tries to apply a custom format to one of the cells in the Spreadsheet using the designated format property, the custom formatting is not being applied to date values as per the expectations and it remains as default.

To Reproduce

  1. Create a Spreadsheet component.
  2. Use the format property of the cells.

Please, check out the following StackBlitz demo: https://stackblitz.com/edit/angular-sbcmcq

Expected behavior The format that is provided in the designated property of the date cell should be applied to the specific cell.

cms-fc commented 6 days ago

i found that changing date to excel numbers worked

function toExcelDate(date) {
  return 25569.0 + ((date.getTime() - (date.getTimezoneOffset() * 60 * 1000)) / (1000 * 60 * 60 * 24));
}