From ec0f3db314f00e5b2e602a89983fd8febc0dcbcb Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Tue, 14 Apr 2015 13:06:22 -0700 Subject: [PATCH] revert(dateparser): "add support for milliseconds" This reverts commit 9f5d389c30fff5dc8efa40abb426864177c39bbc. --- src/dateparser/dateparser.js | 8 ++------ src/dateparser/test/dateparser.spec.js | 10 ---------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/dateparser/dateparser.js b/src/dateparser/dateparser.js index fa3004533b..1b0e8135a3 100644 --- a/src/dateparser/dateparser.js +++ b/src/dateparser/dateparser.js @@ -65,10 +65,6 @@ angular.module('ui.bootstrap.dateparser', []) regex: '[0-9]|[1-5][0-9]', apply: function(value) { this.minutes = +value; } }, - 'sss': { - regex: '[0-9][0-9][0-9]', - apply: function(value) { this.milliseconds = +value; } - }, 'ss': { regex: '[0-5][0-9]', apply: function(value) { this.seconds = +value; } @@ -124,7 +120,7 @@ angular.module('ui.bootstrap.dateparser', []) results = input.match(regex); if ( results && results.length ) { - var fields = { year: 1900, month: 0, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }, dt; + var fields = { year: 1900, month: 0, date: 1, hours: 0, minutes: 0, seconds: 0 }, dt; for( var i = 1, n = results.length; i < n; i++ ) { var mapper = map[i-1]; @@ -134,7 +130,7 @@ angular.module('ui.bootstrap.dateparser', []) } if ( isValid(fields.year, fields.month, fields.date) ) { - dt = new Date(fields.year, fields.month, fields.date, fields.hours, fields.minutes, fields.seconds, fields.milliseconds); + dt = new Date(fields.year, fields.month, fields.date, fields.hours, fields.minutes, fields.seconds); } return dt; diff --git a/src/dateparser/test/dateparser.spec.js b/src/dateparser/test/dateparser.spec.js index 7ed6bb0e58..1314826aa4 100644 --- a/src/dateparser/test/dateparser.spec.js +++ b/src/dateparser/test/dateparser.spec.js @@ -96,16 +96,6 @@ describe('date parser', function () { expectParse('22.March.15.2:1', 'd.MMMM.yy.H:m', new Date(2015, 2, 22, 2, 1)); }); - it('should work correctly for `sss`', function() { - expectParse('22.March.15.123', 'd.MMMM.yy.sss', new Date(2015, 2, 22, 0, 0, 0, 123)); - expectParse('8-March-1991-059', 'd-MMMM-yyyy-sss', new Date(1991, 2, 8, 0, 0, 0, 59)); - expectParse('February/5/1980/000', 'MMMM/d/yyyy/sss', new Date(1980, 1, 5, 0, 0, 0)); - expectParse('1955/February/5 003', 'yyyy/MMMM/d sss', new Date(1955, 1, 5, 0, 0, 0, 3)); - expectParse('11-08-13 046', 'd-MM-yy sss', new Date(2013, 7, 11, 0, 0, 0, 46)); - expectParse('22.March.15.22:33:044', 'd.MMMM.yy.HH:mm:sss', new Date(2015, 2, 22, 22, 33, 0, 44)); - expectParse('22.March.15.0:0:001', 'd.MMMM.yy.H:m:sss', new Date(2015, 2, 22, 0, 0, 0, 1)); - }); - it('should work correctly for `ss`', function() { expectParse('22.March.15.22', 'd.MMMM.yy.ss', new Date(2015, 2, 22, 0, 0, 22)); expectParse('8-March-1991-59', 'd-MMMM-yyyy-ss', new Date(1991, 2, 8, 0, 0, 59));