Unplanned
Last Updated: 11 Jun 2020 08:29 by ADMIN
Mousam
Created on: 10 Jun 2020 15:13
Category: Spreadsheet
Type: Bug Report
0
Spreadsheet does not convert date correctly when "01/01/0001" is entered

Bug report

Reproduction of the problem

  1. Open the Dojo
  2. In the first column enter "01/01/0001"

Current behavior

The Date is displayed as "12/31/0"

Expected/desired behavior

The Date should be displayed correctly.

Environment

  • Kendo UI version: 2020.2.513
  • jQuery version: x.y
  • Browser: [all]
1 comment
ADMIN
Neli
Posted on: 11 Jun 2020 08:29

Hello,

The described behavior is expected.

When a Date in the SpreadSheet is created through the configuration by using the new Date (“01/01/0001”) the SpreadSheet will render “01/01/2001”. JavaScript interprets the year “0001” as the year “2001”. This behavior is due to the fact the dates in JavaScript starts from year 1970.

In cases when the date is entered manually Speadsheet interprets the entered input itself. For example, “01/01/0001” will be interpreted as 1 January of year 1. However, there is a known issue in Excel regarding dates before 1 March 1900. Excel incorrectly treats the year 1900 as a leap year. It accepts the 29 February 1900 as a valid date. As a consequence of this issue date calculations that span 29 February 1900 will be off one day. Below are links with more information on the topic:

https://books.google.bg/books?id=YjrWDwAAQBAJ&pg=PT87&lpg=PT87&dq=excel+is+one+day+off+before&source=bl&ots=jz4BtL5KPR&sig=ACfU3U3MeJLicNhefBi9hrdd2796MyGS0Q&hl=en&sa=X&ved=2ahUKEwjouq_PjPnpAhUIzIUKHYOiC-MQ6AEwCnoECAkQAQ#v=onepage&q=excel%20is%20one%20day%20off%20before&f=false

- https://docs.microsoft.com/en-us/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year

 In order to synchronize the Spreadsheet behavior in Excel, and considering the fact that there is no date as 29 February 1900 in JavaScript, the prior dates will be off with 1 day. So, when 1 January 0001 is entered, the rendered day will be one day off (31 December 0000 year), as there are no negative dates in Excel.

Regards,
Neli
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.