Skip to content

Commit

Permalink
Corrijo bug. Close #9
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Dec 5, 2016
1 parent a22ce3b commit 6169a2b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions lib/discrepances.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ function compareDates(a, b) {
var msDiff = a.getTime()-b.getTime();
var showTimeDiff = Math.abs(msDiff) <= 359999000; // 99 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000;
if(datetime(a).toYmd() !== datetime(b).toYmd()) {
var aas = datetime(a).toYmdHmsM();
var bbs = datetime(b).toYmdHmsM();
res.push(aas.slice(0, 10));
// aas[0]=ymd, aas[1]=hmsm
var aas = datetime(a).toYmdHmsM().split(' ');
var bbs = datetime(b).toYmdHmsM().split(' ');
res.push(aas[0]);
if(timesDiffer) {
res.push(' ');
res.push(aas.substr(11, a.getMilliseconds()?12:8));
res.push(aas[1].substr(0, a.getMilliseconds()?12:8));
}
res.push(' != ');
res.push(bbs.slice(0, 10));
res.push(bbs[0]);
if(timesDiffer) {
res.push(' ');
res.push(bbs.substr(11, b.getMilliseconds()?12:8));
res.push(bbs[1].substr(0, b.getMilliseconds()?12:8));
}
if(showTimeDiff && timesDiffer) { res.push(' => '); }
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"test-cli-ff": "npm run test-cli -- --browsers Firefox",
"test-cli-saf": "npm run test-cli -- --browsers Safari",
"report": "istanbul report",
"all": "npm test && npm run test-cli && npm run test-cov && npm run report && qa-control . -v"
"all": "npm test && npm run test-cov && npm run report && qa-control . -v"
},
"qa-control": {
"package-version": "0.3.0",
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ describe("discrepances", function(){
// esto es para evitar que values:[] tenga fechas distintas a 'a' y 'b'
var dateFixtures = [
{a:fechaActual , b:fechaActual , difference: null },
{skip:'#9', a:new Date(10511,1,3) , b:new Date(10511,1,4) , difference:'10511-02-03 != 10511-02-04' },
{skip:'#9', a:new Date(511,1,3) , b:new Date(511,1,4) , difference:'511-02-03 != 511-02-04' },
{a:new Date(10511,1,3) , b:new Date(10511,1,4) , difference:'10511-02-03 != 10511-02-04' },
{a:new Date(511,1,3) , b:new Date(511,1,4) , difference:'511-02-03 != 511-02-04' },
{a:new Date(2011,1,3) , b:new Date(2011,1,4) , difference:'2011-02-03 != 2011-02-04' },
{a:new Date(1992,11,5) , b:new Date(1935,8,1) , difference:'1992-12-05 != 1935-09-01' },
{a:new Date(1992,11,5,10,0,0) , b:new Date(1935,8,1,15,0,0) ,
Expand Down

0 comments on commit 6169a2b

Please sign in to comment.