Comparing version
@@ -75,17 +75,16 @@ ;(function() { | ||
parse : function(time) { | ||
var date = new Date() | ||
var ms = this.getMilliseconds(time) + this.getTimeZone(time) | ||
date.setUTCFullYear(this.getYear(time)) | ||
date.setUTCMonth(this.getMonth(time)) | ||
date.setUTCDate(this.getDay(time)) | ||
date.setUTCHours(this.getHours(time)) | ||
date.setUTCMinutes(this.getMinutes(time)) | ||
date.setUTCSeconds(this.getSeconds(time)) | ||
date.setUTCMilliseconds(ms) | ||
var msg = date.toString() | ||
var ms = Date.UTC( | ||
this.getYear(time), | ||
this.getMonth(time), | ||
this.getDay(time), | ||
this.getHours(time), | ||
this.getMinutes(time), | ||
this.getSeconds(time), | ||
this.getMilliseconds(time) + this.getTimeZone(time) | ||
) | ||
var date = new Date(ms) | ||
if (!date.valueOf()) return null | ||
return date | ||
}, | ||
toGeneralizedTime: function(date) { | ||
toGeneralizedTime : function(date) { | ||
var ms = date.getUTCMilliseconds() | ||
@@ -106,3 +105,3 @@ var fraction = (ms ? '.' + ms : '') | ||
module.exports = ldap2date | ||
} else if (typeof define === "function" && define.amd) { | ||
} else if (typeof define === 'function' && define.amd) { | ||
define(ldap2date) | ||
@@ -109,0 +108,0 @@ } else { |
{ | ||
"name": "ldap2date", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Parses LDAP Generalized Time Syntax", | ||
@@ -5,0 +5,0 @@ "main": "ldap2date.js", |
@@ -31,3 +31,3 @@ var assert = require('assert') | ||
describe('getHours', function() { | ||
it('should parse the hour', function() { | ||
it('should parse the hours', function() { | ||
var hour = ldap2date.getHours(time) | ||
@@ -39,3 +39,3 @@ assert.strictEqual(hour, 19) | ||
describe('getMinutes', function() { | ||
it('should parse the hour', function() { | ||
it('should parse the minutes', function() { | ||
var minutes = ldap2date.getMinutes(time) | ||
@@ -52,3 +52,3 @@ assert.strictEqual(minutes, 27) | ||
describe('getSeconds', function() { | ||
it('should parse the hour', function() { | ||
it('should parse the seconds', function() { | ||
var seconds = ldap2date.getSeconds(time) | ||
@@ -55,0 +55,0 @@ assert.strictEqual(seconds, 6) |
10482
-1.2%