Comparing version 0.2.1 to 0.2.2
@@ -180,3 +180,3 @@ if ( typeof module !== 'undefined' ) { | ||
case 'g': | ||
return date.getHours() % 12; | ||
return date.getHours() == 0 ? 12 : date.getHours() % 12; | ||
@@ -189,3 +189,3 @@ // 24-hour format, no leading zero | ||
case 'h': | ||
var h = date.getHours() % 12; | ||
var h = date.getHours() == 0 ? 12 : date.getHours() % 12; | ||
return h < 10 ? '0' + h : h; | ||
@@ -192,0 +192,0 @@ |
{ | ||
"name": "daylight", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "lightweight javascript date formatting", | ||
@@ -5,0 +5,0 @@ "main": "daylight.js", |
@@ -143,2 +143,3 @@ var test = require('tape'); | ||
t.equal(formatDate('g', '2014/05/28 17:00:00'), '5'); | ||
t.equal(formatDate('g', '2014/05/28 00:00:00'), '12'); | ||
@@ -157,3 +158,4 @@ t.end(); | ||
t.equal(formatDate('h', date), '09'); | ||
t.equal(formatDate('g', '2014/05/28 17:00:00'), '5'); | ||
t.equal(formatDate('h', '2014/05/28 17:00:00'), '05'); | ||
t.equal(formatDate('h', '2014/05/28 00:00:00'), '12'); | ||
@@ -160,0 +162,0 @@ t.end(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18375
310