Date format Sylk file #1545

Closed
opened 2019-06-24 09:55:38 +00:00 by Slayess · 4 comments
Slayess commented 2019-06-24 09:55:38 +00:00 (Migrated from github.com)

Hello,

I'm converting a Sylk file to CSV, There is special tag on the Sylk file (O;V0 or O;V4) to specify the starting date of the calendar :
01/01/1900 => O;V0 (or none)
01/01/1904 => O;V4
I updated your file "../node_modules/xlsx/xlsx.js" with

Updated line 6938
Source : var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr = [];
By : var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr = [], dV4;

Updated line 6952
Source : case 'O': break; /* options? */
By : 	case 'O': dV4 = rstr.split(';').indexOf('V4') != -1 ? 1460 : 0; break; /* options? */

Updated line 6972
Source : if(next_cell_format !== null && SSF.is_date(next_cell_format)) val = numdate(val);
By : if(next_cell_format !== null && SSF.is_date(next_cell_format)) val = numdate(val+dV4);

Could you please tell me if is it the correct way to do that ?
Thanks in advance.

Hello, I'm converting a Sylk file to CSV, There is special tag on the Sylk file (O;V0 or O;V4) to specify the starting date of the calendar : 01/01/1900 => O;V0 (or none) 01/01/1904 => O;V4 I updated your file "../node_modules/xlsx/xlsx.js" with ``` Updated line 6938 Source : var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr = []; By : var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr = [], dV4; Updated line 6952 Source : case 'O': break; /* options? */ By : case 'O': dV4 = rstr.split(';').indexOf('V4') != -1 ? 1460 : 0; break; /* options? */ Updated line 6972 Source : if(next_cell_format !== null && SSF.is_date(next_cell_format)) val = numdate(val); By : if(next_cell_format !== null && SSF.is_date(next_cell_format)) val = numdate(val+dV4); ``` Could you please tell me if is it the correct way to do that ? Thanks in advance.
SheetJSDev commented 2019-06-25 00:35:50 +00:00 (Migrated from github.com)

Can you share a sample file? Ideally it would set the 1904 date mode in a few places.

Can you share a sample file? Ideally it would set the 1904 date mode in a few places.
Slayess commented 2019-06-25 06:16:46 +00:00 (Migrated from github.com)

Oups sorry, I didn't think it.
2 files added :

  1. 1900.slk ( option "Use the calendar from 1904" untick)
    "O" tag fixed to : O;D;V0
  2. 1904.slk ( option "Use the calendar from 1904" tick)
    "O" tag fixed to : O;D;V4

The same «number date» has been fixed to 1, see bellow the result :
1900.slk : 1 => 01/01/1900
1904.slk : 1 => 02/01/1904

Oups sorry, I didn't think it. 2 files added : 1) [1900.slk](https://we.tl/t-6HQdW1d7gZ) ( option "Use the calendar from 1904" untick) "O" tag fixed to : O;D;V0 2) [1904.slk](https://we.tl/t-5aPP3Ccel3) ( option "Use the calendar from 1904" tick) "O" tag fixed to : O;D;V4 The same «number date» has been fixed to 1, see bellow the result : 1900.slk : 1 => 01/01/1900 1904.slk : 1 => 02/01/1904
SheetJSDev commented 2021-09-22 01:29:13 +00:00 (Migrated from github.com)

The V field of the O record is interpreted as follows:

0: 1900 date system

1, 2, 3, 4: 1904 date system

Any other value: SYLK record warning, fall back to 1900

The `V` field of the `O` record is interpreted as follows: `0`: 1900 date system `1`, `2`, `3`, `4`: 1904 date system Any other value: SYLK record warning, fall back to 1900
SheetJSDev commented 2022-03-09 09:03:56 +00:00 (Migrated from github.com)

As mentioned earlier, a PR that checks for V[1-4] would suffice

As mentioned earlier, a PR that checks for V[1-4] would suffice
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#1545
No description provided.