Code Monkey home page Code Monkey logo

ssf's Introduction

ssf's People

Contributors

bryanbraun avatar cubewise-tryan avatar garrettluu avatar reviewher avatar segfaultx64 avatar sheetjsdev avatar vvaldersteins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssf's Issues

Uncaught SyntaxError: Unexpected token '<'

Hi

I ran "yarn add ssf". I haven't done any imports of this library in my existing project just ran "yarn add ssf". After that I ran"yarn install" to install all dependencies and then "yarn start".
No compilation error just "Uncaught SyntaxError: Unexpected token '<'" in chrome console
image

Tried on react-scripts versions 3.4.0 - not working,
3.3.1 - not working,
3.2.0 WORKING :)

So if react-scripts in version 3.2.0 works just fine is it something that you guys could fix or is it something wrong with react-scripts :D

Because of this error library xlsx is not working since ssf is one of it's dependencies

Unexpected Duration Output

When I provide the value 0.00556 with the format [h]:mm:ss the result is 0:08:00 (which is correct), however when provided the value 0.00555 the result is 0:07:00. I expect that result to be 0:08:00.

absolute hour issue

from SheetJS/sheetjs#98 reported by @tedbeer

format_cell({v: 0, t: 'n', z: '[h]:mm'}) returns '0:01'
In Excel the cell is correctly shown as '0:00'

If format is '[h]:mm:ss' the cell is formatted correctly to '0:00:00'

parse_date_code is off by 1 month

Value returned from SSF.parse_date_code has m (month) value offset by +1.

moment.fromOADate (moment-msdate plugin) gives the correct value.

Negative Durations Are Empty

When I provide the negative value -1.00069444444444 with the format [h]:mm:ss the result is an empty string. I expect that result be -24:01:00.

Also thanks for all the great work on this really helpful utility!

eval_fmt doesn't support formats like "D\-MMM\-YYYY" (with upper case)

These custom formats were generated from Open Office. But Excel opens it with no problem. I don't know whether this follows standards or not, or how much this project wants to support xls files generated outside MS Excel.

But the fix I was thinking of is below. Is this correct enough?

diff --git a/xls.js b/xls.js
index 8d3881e..a34eacf 100644
--- a/xls.js
+++ b/xls.js
@@ -502,10 +502,12 @@ function eval_fmt(fmt, v, opts, flen) {
                        case '@': /* Text Placeholder */
                                out.push({t:'T', v:v}); ++i; break;
                        /* Dates */
-                       case 'm': case 'd': case 'y': case 'h': case 's': case 'e':
+                       case 'm': case 'M': case 'd': case 'D': case 'y': case 'Y': case 'h': case 'H': case 's': case 'S': case 'e': case 'E':
                                if(v < 0) return "";
                                if(!dt) dt = parse_date_code(v, opts);
                                o = fmt[i]; while(fmt[++i] === c) o+=c;
+                               o = o.toLowerCase();
+                               c = c.toLowerCase();
                                if(c === 's' && fmt[i] === '.' && fmt[i+1] === '0') { o+='.'; while(fmt[++i] === '0') o+= '0'; }
                                if(c === 'm' && lst.toLowerCase() === 'h') c = 'M'; /* m = minute */
                                if(c === 'h') c = hr;
@@ -592,6 +594,7 @@ var format = function format(fmt,v,o) {
        fixopts(o = (o||{}));
        if(fmt === 0) return general_fmt(v, o);
        if(typeof fmt === 'number') fmt = table_fmt[fmt];
+       if (fmt && fmt.toUpperCase() === 'GENERAL') return general_fmt(v, o);
        var f = choose_fmt(fmt, v, o);
        return eval_fmt(f[1], v, o, f[0]);
 };

P. S. Some numbers came with the custom format "GENERAL"

Miscellaneous formats

from the test suite:

" Excellent"
" Fair"
" Good"
" Poor"
" Very Good"
"$"#,##0
"$"#,##0.00
"$"#,##0.00_);[Red]\("$"#,##0.00\)
"$"#,##0.00_);\("$"#,##0.00\)
"$"#,##0;[Red]\-"$"#,##0
"$"#,##0_);[Red]\("$"#,##0\)
"$"#,##0_);\("$"#,##0\)
"Haha!"\ @\ "Yeah!"
"TRUE";"TRUE";"FALSE"
"True";"True";"False";@
"Years: "0
"Yes";"Yes";"No";@
"kl "hh:mm:ss;@
"£"#,##0.00
"£"#,##0;[Red]\-"£"#,##0
"€"#,##0.00
"€"\ #,##0.00_-
"上午/下午 "hh"時"mm"分"ss"秒 "
"¥"#,##0.00;"¥"\-#,##0.00
#
# ?/?
# ??/??
#" "?/?
#" "??/??
#"abded"\ ??/??
###0.00;-###0.00
###0;-###0
##0.0E+0
#,##0
#,##0 ;(#,##0)
#,##0 ;[Red](#,##0)
#,##0"р.";[Red]\-#,##0"р."
#,##0.0
#,##0.00
#,##0.00 "�"
#,##0.00 €;-#,##0.00 €
#,##0.00"р.";[Red]\-#,##0.00"р."
#,##0.000
#,##0.0000
#,##0.00000
#,##0.000000
#,##0.0000000
#,##0.00000000
#,##0.000000000
#,##0.00000000;[Red]#,##0.00000000
#,##0.0000_ 
#,##0.000_ 
#,##0.000_);\(#,##0.000\)
#,##0.00;(#,##0.00)
#,##0.00;(#,##0.00);0.00
#,##0.00;[Red](#,##0.00)
#,##0.00;[Red]\(#,##0.00\)
#,##0.00;\(#,##0.00\)
#,##0.00[$₹-449]_);\(#,##0.00[$₹-449]\)
#,##0.00\ "р."
#,##0.00\ "р.";[Red]\-#,##0.00\ "р."
#,##0.00\ [$€-407]
#,##0.00\ [$€-40C]
#,##0.00_);\(#,##0.00\)
#,##0.00_р_.;[Red]\-#,##0.00_р_.
#,##0.00_р_.;\-#,##0.00_р_.
#,##0.0;[Red]#,##0.0
#,##0.0_ ;\-#,##0.0\ 
#,##0.0_);[Red]\(#,##0.0\)
#,##0.0_);\(#,##0.0\)
#,##0;\-#,##0;0
#,##0\ "р.";[Red]\-#,##0\ "р."
#,##0\ "р.";\-#,##0\ "р."
#,##0\ ;[Red]\(#,##0\)
#,##0\ ;\(#,##0\)
#,##0_ 
#,##0_ ;[Red]\-#,##0\ 
#,##0_);[Red]\(#,##0\)
#,##0_р_.;[Red]\-#,##0_р_.
#,##0_р_.;\-#,##0_р_.
#.0000,,
#0
#0.00
#0.0000
#\ ?/10
#\ ?/2
#\ ?/4
#\ ?/8
#\ ?/?
#\ ??/100
#\ ??/100;[Red]\(#\ ??/16\)
#\ ??/16
#\ ??/??
#\ ??/?????????
#\ ???/???
**\ #,###,#00,000.00,**
0
0"abde".0"??"000E+00
0%
0.0
0.0%
0.00
0.00"°"
0.00%
0.000
0.000%
0.0000
0.000000
0.00000000
0.000000000
0.000000000%
0.00000000000
0.000000000000000
0.00000000E+00
0.0000E+00
0.00;[Red]0.00
0.00E+00
0.00_);[Red]\(0.00\)
0.00_);\(0.00\)
0.0_ 
00.00.00.000
00.000%
0000
00000
00000000
000000000
00000\-0000
00000\-00000
000\-00\-0000
0;[Red]0
0\-00000\-00000\-0
0_);[Red]\(0\)
0_);\(0\)
@
A/P
AM/PM
AM/PMh"時"mm"分"ss"秒";@
D
DD
DD/MM/YY;@
DD/MM/YYYY
DD/MM/YYYY;@
DDD
DDDD
DDDD", "MMMM\ DD", "YYYY
Euro Currency
GENERAL
General
H
H:MM:SS\ AM/PM
HH:MM
HH:MM:SS\ AM/PM
HHM
HHMM
HH[MM]
HH[M]
M/D/YYYY
M/D/YYYY\ H:MM
MM/DD/YY
S
SS
YY
YYM
YYMM
YYMMM
YYMMMM
YYMMMMM
YYYY
YYYY-MM-DD HH:MM:SS
YYYY\-MM\-DD
[$$-409]#,##0
[$$-409]#,##0.00
[$$-409]#,##0.00_);[Red]\([$$-409]#,##0.00\)
[$$-C09]#,##0.00
[$-100042A]h:mm:ss\ AM/PM;@
[$-1010409]0.000%
[$-1010409]General
[$-1010409]d/m/yyyy\ h:mm\ AM/PM;@
[$-1010409]dddd, mmmm dd, yyyy
[$-1010409]m/d/yyyy
[$-1409]h:mm:ss\ AM/PM;@
[$-2000000]h:mm:ss;@
[$-2010401]d/mm/yyyy\ h:mm\ AM/PM;@
[$-4000439]h:mm:ss\ AM/PM;@
[$-4010439]d/m/yyyy\ h:mm\ AM/PM;@
[$-409]AM/PM\ hh:mm:ss;@
[$-409]d/m/yyyy\ hh:mm;@
[$-409]d\-mmm;@
[$-409]d\-mmm\-yy;@
[$-409]d\-mmm\-yyyy;@
[$-409]dd/mm/yyyy\ hh:mm;@
[$-409]dd\-mmm\-yy;@
[$-409]h:mm:ss\ AM/PM;@
[$-409]h:mm\ AM/PM;@
[$-409]m/d/yy\ h:mm\ AM/PM;@
[$-409]mmm\-yy;@
[$-409]mmmm\ d\,\ yyyy;@
[$-409]mmmm\-yy;@
[$-409]mmmmm;@
[$-409]mmmmm\-yy;@
[$-40E]h\ "óra"\ m\ "perckor"\ AM/PM;@
[$-412]AM/PM\ h"시"\ mm"분"\ ss"초";@
[$-41C]h:mm:ss\.AM/PM;@
[$-449]hh:mm:ss\ AM/PM;@
[$-44E]hh:mm:ss\ AM/PM;@
[$-44F]hh:mm:ss\ AM/PM;@
[$-D000409]h:mm\ AM/PM;@
[$-D010000]d/mm/yyyy\ h:mm\ "น.";@
[$-F400]h:mm:ss\ AM/PM
[$-F800]dddd\,\ mmmm\ dd\,\ yyyy
[$AUD]\ #,##0.00
[$RD$-1C0A]#,##0.00;[Red]\-[$RD$-1C0A]#,##0.00
[$SFr.-810]\ #,##0.00_);[Red]\([$SFr.-810]\ #,##0.00\)
[$£-809]#,##0.00;[Red][$£-809]#,##0.00
[$¥-411]#,##0.00
[$¥-804]#,##0.00
[<0]"";0%
[<=9999999]###\-####;\(###\)\ ###\-####
[=0]?;#,##0.00
[=0]?;0%
[=0]?;[<4.16666666666667][hh]:mm:ss;[hh]:mm
[>999999]#,,"M";[>999]#,"K";#
[>999999]#.000,,"M";[>999]#.000,"K";#.000
[>=100000]0.000\ \";[Red]0.000\ \<\ \>\ \"\ \&\ \'\ 
[>=100000]0.000\ \<;[Red]0.000\ \>
[BLACK]@
[BLUE]GENERAL
[Black]@
[Blue]General
[CYAN]@
[Cyan]@
[DBNum1][$-804]AM/PMh"时"mm"分";@
[DBNum1][$-804]General
[DBNum1][$-804]h"时"mm"分";@
[ENG][$-1004]dddd\,\ d\ mmmm\,\ yyyy;@
[ENG][$-101040D]d\ mmmm\ yyyy;@
[ENG][$-101042A]d\ mmmm\ yyyy;@
[ENG][$-140C]dddd\ "YeahWoo!"\ ddd\ mmmm\ yyyy;@
[ENG][$-2C0A]dddd\ d" de "mmmm" de "yyyy;@
[ENG][$-402]dd\ mmmm\ yyyy\ "г.";@
[ENG][$-403]dddd\,\ d" / "mmmm" / "yyyy;@
[ENG][$-405]d\.\ mmmm\ yyyy;@
[ENG][$-408]d\ mmmm\ yyyy;@
[ENG][$-409]d\-mmm;@
[ENG][$-409]d\-mmm\-yy;@
[ENG][$-409]d\-mmm\-yyyy;@
[ENG][$-409]dd\-mmm\-yy;@
[ENG][$-409]mmm\-yy;@
[ENG][$-409]mmmm\ d\,\ yyyy;@
[ENG][$-409]mmmm\-yy;@
[ENG][$-40B]d\.\ mmmm\t\a\ yyyy;@
[ENG][$-40C]d/mmm/yyyy;@
[ENG][$-40E]yyyy/\ mmmm\ d\.;@
[ENG][$-40F]dd\.\ mmmm\ yyyy;@
[ENG][$-410]d\ mmmm\ yyyy;@
[ENG][$-415]d\ mmmm\ yyyy;@
[ENG][$-416]d\ \ mmmm\,\ yyyy;@
[ENG][$-418]d\ mmmm\ yyyy;@
[ENG][$-41A]d\.\ mmmm\ yyyy\.;@
[ENG][$-41B]d\.\ mmmm\ yyyy;@
[ENG][$-41D]"den "\ d\ mmmm\ yyyy;@
[ENG][$-420]dddd\,\ dd\ mmmm\,\ yyyy;@
[ENG][$-421]dd\ mmmm\ yyyy;@
[ENG][$-424]dddd\,\ d\.\ mmmm\ yyyy;@
[ENG][$-425]dddd\,\ d\.\ mmmm\ yyyy;@
[ENG][$-426]dddd\,\ yyyy". gada "d\.\ mmmm;@
[ENG][$-427]yyyy\ "m."\ mmmm\ d\ "d.";@
[ENG][$-42B]dddd\,\ d\ mmmm\ yyyy;@
[ENG][$-42C]d\ mmmm\ yyyy;@
[ENG][$-42D]yyyy"(e)ko"\ mmmm"ren"\ d"a";@
[ENG][$-42F]dddd\,\ dd\ mmmm\ yyyy;@
[ENG][$-437]yyyy\ \წ\ლ\ი\ს\ dd\ mm\,\ dddd;@
[ENG][$-438]d\.\ mmmm\ yyyy;@
[ENG][$-43F]d\ mmmm\ yyyy\ "ж.";@
[ENG][$-444]d\ mmmm\ yyyy;@
[ENG][$-449]dd\ mmmm\ yyyy;@
[ENG][$-44E]d\ mmmm\ yyyy;@
[ENG][$-44F]dd\ mmmm\ yyyy\ dddd;@
[ENG][$-457]dd\ mmmm\ yyyy;@
[ENG][$-813]dddd\ d\ mmmm\ yyyy;@
[ENG][$-81A]dddd\,\ d\.\ mmmm\ yyyy;@
[ENG][$-82C]d\ mmmm\ yyyy;@
[ENG][$-843]yyyy\ "й""и""л"\ d/mmmm;@
[ENG][$-C07]dddd\,\ dd\.\ mmmm\ yyyy;@
[ENG][$-FC19]yyyy\,\ dd\ mmmm;@
[ENG][$-FC22]d\ mmmm\ yyyy" р.";@
[ENG][$-FC23]d\ mmmm\ yyyy;@
[GREEN]#,###
[Green]#,###
[HH]
[HIJ][$-2060401]d/mm/yyyy\ h:mm\ AM/PM;@
[HIJ][$-2060401]d\ mmmm\ yyyy;@
[H]
[JPN][$-411]gggyy"年"m"月"d"日"\ dddd;@
[MAGENTA]0.00
[Magenta]0.00
[RED]#.##
[Red]#.##
[Red][<-25]General;[Blue][>25]General;[Green]General;[Yellow]General\ 
[Red][<=-25]General;[Blue][>=25]General;[Green]General;[Yellow]General
[Red][<>50]General;[Blue]000
[Red][=50]General;[Blue]000
[SS]
[S]
[TWN][DBNum1][$-404]y"年"m"月"d"日";@
[WHITE]0.0
[White]0.0
[YELLOW]@
[Yellow]@
[h]
[h]:mm:ss
[h]:mm:ss;@
[h]\.mm" Uhr ";@
[hh]
[s]
[ss]
\#\r\e\c
\$#,##0_);[Red]"($"#,##0\)
\$0.00
\C\O\B\ \o\n\ @
\C\R\O\N\T\A\B\ \o\n\ @
\R\e\s\u\l\t\ \o\n\ @
\S\Q\L\ \:\ @
\S\Q\L\ \R\e\q\u\e\s\t\ \f\o\r\ @
\c\c\c?????0"aaaa"0"bbbb"000000.00%
\u\n\t\i\l\ h:mm;@
_ "¥"* #,##0.00_ "Positive";_ "¥"* \-#,##0.00_ ;_ "¥"* "-"??_ "Negtive";_ @_ \ "Zero"
_ * #,##0.00_)[$﷼-429]_ ;_ * \(#,##0.00\)[$﷼-429]_ ;_ * "-"??_)[$﷼-429]_ ;_ @_ 
_ * #,##0_ ;_ * \-#,##0_ ;[Red]_ * "-"_ ;_ @_ 
_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)
_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"??_);_(@_)
_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)
_(* #,##0.0000_);_(* \(#,##0.0000\);_(* "-"??_);_(@_)
_(* #,##0.000_);_(* \(#,##0.000\);_(* "-"??_);_(@_)
_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)
_(* #,##0.0_);_(* \(#,##0.0\);_(* "-"??_);_(@_)
_(* #,##0_);_(* \(#,##0\);_(* "-"??_);_(@_)
_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)
_([$ANG]\ * #,##0.0_);_([$ANG]\ * \(#,##0.0\);_([$ANG]\ * "-"?_);_(@_)
_-"€"\ * #,##0.00_-;_-"€"\ * #,##0.00\-;_-"€"\ * "-"??_-;_-@_-
_-* #,##0.00" TL"_-;\-* #,##0.00" TL"_-;_-* \-??" TL"_-;_-@_-
_-* #,##0.00" €"_-;\-* #,##0.00" €"_-;_-* \-??" €"_-;_-@_-
_-* #,##0.00\ "р."_-;\-* #,##0.00\ "р."_-;_-* "-"??\ "р."_-;_-@_-
_-* #,##0.00\ "€"_-;\-* #,##0.00\ "€"_-;_-* "-"??\ "€"_-;_-@_-
_-* #,##0.00\ [$€-407]_-;\-* #,##0.00\ [$€-407]_-;_-* \-??\ [$€-407]_-;_-@_-
_-* #,##0.0\ _F_-;\-* #,##0.0\ _F_-;_-* "-"??\ _F_-;_-@_-
_-* #,##0\ "€"_-;\-* #,##0\ "€"_-;_-* "-"\ "€"_-;_-@_-
_-* #,##0_-;\-* #,##0_-;_-* "-"??_-;_-@_-
_-\$* #,##0.0_ ;_-\$* \-#,##0.0\ ;_-\$* "-"?_ ;_-@_ 
d
d-mmm
d-mmm-yy
d/m
d/m/yy;@
d/m/yyyy;@
d/mm/yy;@
d/mm/yyyy;@
d\-mmm
d\-mmm\-yyyy
dd
dd"-"mmm"-"yyyy
dd/m/yyyy
dd/mm/yy
dd/mm/yy;@
dd/mm/yy\ hh:mm
dd/mm/yyyy
dd/mm/yyyy\ hh:mm:ss
dd/mmm
dd\-mm\-yy
dd\-mmm\-yy
dd\-mmm\-yyyy\ hh:mm:ss.000
dd\/mm\/yy
dd\/mm\/yyyy
ddd
dddd
dddd, mmmm dd, yyyy
h
h"时"mm"分"ss"秒";@
h"時"mm"分"ss"秒";@
h:mm
h:mm AM/PM
h:mm:ss
h:mm:ss AM/PM
h:mm:ss;@
h:mm;@
h\.mm" Uhr ";@
h\.mm" h";@
h\.mm" u.";@
hh":"mm AM/PM
hh:mm:ss
hh:mm:ss\ AM/PM
hh\.mm" h";@
hhm
hhmm
m"月"d"日"
m/d/yy
m/d/yy h:mm
m/d/yy;@
m/d/yy\ h:mm
m/d/yy\ h:mm;@
m/d/yyyy
m/d/yyyy;@
m/d/yyyy\ h:mm:ss;@
m/d;@
m\/d\/yyyy
mm/dd
mm/dd/yy
mm/dd/yy;@
mm/dd/yyyy
mm:ss
mm:ss.0;@
mmm d, yyyy
mmm" "d", "yyyy
mmm-yy
mmm-yy;@
mmm/yy
mmm\-yy
mmm\-yy;@
mmm\-yyyy
mmmm\ d\,\ yyyy
mmmm\ yyyy
mmss.0
s
ss
yy
yy/mm/dd
yy\.mm\.dd
yym
yymm
yymmm
yymmmm
yymmmmm
yyyy
yyyy"년"\ m"월"\ d"일";@
yyyy-m-d h:mm AM/PM
yyyy-mm-dd
yyyy/mm/dd
yyyy\-m\-d\ hh:mm:ss
yyyy\-mm\-dd
yyyy\-mm\-dd;@
yyyy\-mm\-dd\ h:mm
yyyy\-mm\-dd\Thh:mm
yyyy\-mm\-dd\Thhmmss.000

How to handle comma and thoushand separators

Hi All.
First I would like to thank all users and admins here, The code is awesome.

I am facing am issue while loading files with "thousands".
I am from Brazil, using brazilian formatation, but I don´t know if this is the issue.

As you see below the thousand numbers are being displayed in the output as "2,590".
That´s ok, I can live with it, although when I try to separate all colaumns by comma, I split the number.
Is it possible to change the column separator from , to ; ?

Regards.

29/07/16 15:00,CX. Test,10,"2,590","7,770",78,,,
29/07/16 13:00,Test,143,766,"2,298",329,60,2%,
29/07/16 17:00,Composta,231,730,"2,190",506,60,2%,
29/07/16 19:00,Composta,263,510,"1,530",402,32,2%,
29/07/16 21:00,Composta,313,561,"1,683",527,55,2%,
29/07/16 23:00,Composta,354,535,"1,605",568,50,2%,

Custom table formats?

Hi there,

As a temporary solution, I have had to modify the source files to change the date/time formats within the table_fmt variable to suit my needs, however this is FAR from ideal.

Have I completely missed where the ability to provide these as an option, or does this yet not exist?

I'm using both the XLS and XLSX projects, which both use SSF, however it looks like that table_fmt is used outside of SSF to format the cell values.

Before I go making any PR's, could you clarify whether this is supported?

Thanks

Uncaught Error: unsupported format |#,###.##|

Hi

It seems the library doesn't like this:

import ssf from 'ssf'

ssf.format('#,###.##', 123456678.92)

because I get this runtime error:

Uncaught Error: unsupported format |#,###.##|

Incorrect output depending on system's time zone

console.log(ssf.format('yyyy-mm', new Date('2023-01-01T00:00:00')))

2023-01 => correct

Change computer timezone to Alaska

console.log(ssf.format('yyyy-mm', new Date('2023-01-01T00:00:00')))

2022-12 => INCORRECT

Note that I tried to raise the issue on but there seems to be an error when signing up for an account: "The CAPTCHA code is incorrect." even though not captcha was displayed.

Minus sign handling when negative formatting string is provided

Hi, this is similar to #15, but specific to the handling of the minus sign. If you use the formatting string

.##;-"£"#.

Value:
-3.1415926535

the result is
Formatted Number:
-£-3.14
Formatted Text
-3.1415926535

Notice the double minus sign before and after the currency.
The format above is valid in Excel, and works as expected, only one minus sign is shown.

image

incorrect output with '#,##0.00' format

SSF.format( "#,##0.00", 3.105 ) gives a result of '3.10' - it should be '3.11'.
It seems there is a bug in dec function.
Current version:
・get decimal part:
3.105 -> 0.104999998
・power the decimal part
Math.pow(0.1049998, 2) -> 10.49998
・round off powered decimal part
Math.floor(10.49998) -> 10

Shloud The logic be as below.
Math.pow(3.105,2) -> 310.5 -> Math.floor(310.5) -> 311 -> 311/100 -> 3.11

IE8 cell.w formatted cell value missing

Hi,

js-xls has an issue in IE8 where the formatted value of cells is not added to the cell object. I've traced this down to the eval_fmt function:

function eval_fmt(fmt, v, opts, flen) {
    var out = [], o = "", i = 0, c = "", lst='t', q, dt, j, cc;
    var hr='H';
    /* Tokenize */
    while(i < fmt.length) {
        switch((c = fmt[i])) {
                ...
                }
         ...
        }
    ...
}

IE9 and below don't support accessing a string using array syntax (e.g. c = fmt[i]). I propose converting the string to an array, although I am not sure what impact that would have on efficiency.

Cannot place dollar sign after number

Trying to format a number like 3.14$ doesn't seem to work.

#.00"$" outputs 3.14
#.00$ outputs 3.14
#.00 $ outputs 3.14 $, but the space is undesirable

bug with the position of the $ in a negative number

I think this bug only happens with negative currency and only for numbers with four or more digits. For example, $(2,500.00) will get parsed into (2$,500.00). or $(12,500.00) will get parsed into (12$,500.00).

incorrect output with '#,##0.0' format

SSF.format( "#,##0.0", 0.99 ) gives a result of '0.1' - it should be '1.0'.

same applies down to 0.95, below that it works correctly. rounding issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.