Issue parsing #181
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#181
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I have an strange issue for this special line:
that become this :
blabla,town,,blabla3,,12ok
blabla2,23/02/2015,,blabla4,,2/23/15
You can notice that the second 23/2/15 become 2/23/15.
Here is the link of the xlsx file : http://goo.gl/dc35Yq
Kind regards,
Charles
@CharlesNo this is what shows up when I open the file:
Some date formats are based on the regional settings of the computer (so it will look different in different systems). Currently the default US regional short date setting
m/d/yy
is manually forced, although it is a good idea to add an option to indicate system settings.@SheetJSDev thank you for your very quick answer
I did a hack for myself on the xslx.js on parse_date_code, juste inverted two index in the return :
And so, with moment.js, use moment(dateNoMoreUS, 'D-M-YY'), and it works pretty well for the moment (haha).
Edit:
Finally nope, but I found more details about the problem:
Ok I did this hack on xlsx.js, now the problem is that my 'UK' date we can see on the post above on cell B2 have the day and month reversed too.
What I see on a English Excel:
What I get after parsing :
02/04/2015
and
3/2/15
So I don't know why, hope it can helps you, looks like each cell have a regional setting ?
(I revert my own 'hack', certainly I have to hack elsewhere)
Edit2:
On the function format, at the end of the method before the return,
I added this :
if (f[1] == 'm/d/yy') f[1] = 'dd/mm/yyyy';
It does the trick for me for the moment, and it's a way easier when all dates are the same format.
Kind regards,
Charles.
@CharlesNo it's not the cell, it's actually the number format. To see what's going on, after the line
cf = styles.CellXf[tag.s];
add a lineif(cf) console.log(p, cf.numFmtId);
In the first date cell, you see
{ t: 'n', v: 42058 } 172
which indicates a custom date format. In the second cell, you see{ t: 'n', v: 42058 } 14
, which references the localized date format. Gotta love the magic here :(If you want to hack it, the easiest way is to override the format table:
It looks like the format for your region is
dd/mm/yyyy;@
, so just replacing that entry should do the trick in the very short term.PS: @pietersv fun times here: ECMA-376 gives an incorrect date format for code 14 (and does not indicate that the format is localized) and [MS-XLS] 2.5.165 directs people to ECMA-376.
@SheetJSDev Thank you very much, I should have take a look upper in the code, I'm sure I scrolled on it without minding...
Thank you again, if you need xlsx files for helping you to debug, don't hesitate to ask me.
Regards,
Charles.
We are pushing a change that allows you to specify a
dateNF
option to the parser to override the date format. It will correctly write a file with the original format, but the JS API will use the specified format instead.