From 5bcd966b227c1ab3ff23b3b118586759c19c0629 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Tue, 16 May 2017 15:22:19 -0400 Subject: [PATCH] version bump 0.9.3 - fix rollover for near-integral dates (h/t @HuFlungDu) - removed ssf.md from npm dist --- .npmignore | 1 + Makefile | 2 +- bits/01_version.js | 2 +- bits/50_date.js | 4 ++-- package.json | 4 ++-- ssf.flow.js | 6 +++--- ssf.js | 6 +++--- test/oddities.json | 1 + 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.npmignore b/.npmignore index 5773d51..0636bb1 100644 --- a/.npmignore +++ b/.npmignore @@ -39,3 +39,4 @@ bits/ .vocrc v8.log perf.log +ssf.md diff --git a/Makefile b/Makefile index a6f56d2..9e72bcb 100755 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ travis: ## Run test suite with minimal output mocha -R dot -t 30000 .PHONY: ctest -ctest: +ctest: ## Build browser test fixtures browserify -t brfs test/{dateNF,exp,fraction,general,implied,oddities,utilities,comma,valid}.js > ctest/test.js .PHONY: ctestserv diff --git a/bits/01_version.js b/bits/01_version.js index 7528349..d1260b4 100644 --- a/bits/01_version.js +++ b/bits/01_version.js @@ -1 +1 @@ -SSF.version = '0.9.2'; +SSF.version = '0.9.3'; diff --git a/bits/50_date.js b/bits/50_date.js index 3a15080..2d8df8e 100644 --- a/bits/50_date.js +++ b/bits/50_date.js @@ -6,9 +6,9 @@ function parse_date_code(v/*:number*/,opts/*:?any*/,b2/*:?boolean*/) { if(Math.abs(out.u) < 1e-6) out.u = 0; fixopts(opts != null ? opts : (opts=[])); if(opts.date1904) date += 1462; - if(out.u > 0.999) { + if(out.u > 0.9999) { out.u = 0; - if(++time == 86400) { time = 0; ++date; } + if(++time == 86400) { out.T = time = 0; ++date; ++out.D; } } if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;} else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;} diff --git a/package.json b/package.json index cc9ae5d..63bd210 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ssf", - "version": "0.9.2", + "version": "0.9.3", "author": "SheetJS", "description": "Format data using ECMA-376 spreadsheet Format Codes", "keywords": [ "format", "sprintf", "spreadsheet" ], @@ -15,7 +15,7 @@ }, "devDependencies": { "mocha":"", - "uglify-js":"" + "@sheetjs/uglify-js":"" }, "repository": { "type":"git", "url":"git://github.com/SheetJS/ssf.git" }, "scripts": { diff --git a/ssf.flow.js b/ssf.flow.js index aa6c366..caacba5 100644 --- a/ssf.flow.js +++ b/ssf.flow.js @@ -2,7 +2,7 @@ /*jshint -W041 */ var SSF = {}; var make_ssf = function make_ssf(SSF){ -SSF.version = '0.9.2'; +SSF.version = '0.9.3'; function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; } function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; } function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} @@ -152,9 +152,9 @@ function parse_date_code(v/*:number*/,opts/*:?any*/,b2/*:?boolean*/) { if(Math.abs(out.u) < 1e-6) out.u = 0; fixopts(opts != null ? opts : (opts=[])); if(opts.date1904) date += 1462; - if(out.u > 0.999) { + if(out.u > 0.9999) { out.u = 0; - if(++time == 86400) { time = 0; ++date; } + if(++time == 86400) { out.T = time = 0; ++date; ++out.D; } } if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;} else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;} diff --git a/ssf.js b/ssf.js index 8ed4500..77b6be4 100644 --- a/ssf.js +++ b/ssf.js @@ -2,7 +2,7 @@ /*jshint -W041 */ var SSF = {}; var make_ssf = function make_ssf(SSF){ -SSF.version = '0.9.2'; +SSF.version = '0.9.3'; function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; } function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; } function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} @@ -152,9 +152,9 @@ function parse_date_code(v,opts,b2) { if(Math.abs(out.u) < 1e-6) out.u = 0; fixopts(opts != null ? opts : (opts=[])); if(opts.date1904) date += 1462; - if(out.u > 0.999) { + if(out.u > 0.9999) { out.u = 0; - if(++time == 86400) { time = 0; ++date; } + if(++time == 86400) { out.T = time = 0; ++date; ++out.D; } } if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;} else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;} diff --git a/test/oddities.json b/test/oddities.json index 740d7ce..56fb3e1 100644 --- a/test/oddities.json +++ b/test/oddities.json @@ -158,5 +158,6 @@ ["\\,##.??;\\(#,###.??\\);0", [15,",15. ","#"], [14.3453453,",14.35","#"], [12.1,",12.1 ","#"], [0,"0","#"], [-15,"(15. )","#"], [-14.3453453,"(14.35)","#"], [-12.1,"(12.1 )","#"], [1,",1. ","#"]], ["\"£\"#.####;-\"£\"#.####", [3.141592654, "£3.1416"], [-3.141592654, "-£3.1416"]], + ["[h]:mm:ss;@", [2.9999999999999996, "72:00:00"]], ["\"foo\";\"bar\";\"baz\";\"qux\";\"foobar\"", [1], [0], [-1], ["sheetjs"]] ]