ember-moment
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -9,4 +9,6 @@ import Ember from 'ember'; | ||
if (length === 1) { | ||
throw new TypeError('Invalid Number of arguments, expected atleast 1'); | ||
if (length === 1 || length > 4) { | ||
// there's one extra argument that handlebars adds to the end, | ||
// which explains the difference in what we are checking and the error we are raising | ||
throw new TypeError('Invalid Number of arguments, expected at least 1 and at most 3'); | ||
} | ||
@@ -17,3 +19,6 @@ | ||
if (length === 2) { | ||
args.push('LLLL'); | ||
output = 'LLLL'; | ||
} | ||
else if (length === 3) { | ||
output = maybeOutput; | ||
} else if (length > 3) { | ||
@@ -20,0 +25,0 @@ args.push(maybeInput); |
{ | ||
"name": "ember-moment", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "Moment.js template helpers for ember", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -9,3 +9,4 @@ import Ember from 'ember'; | ||
computedDate: moment('date', 'MM/DD/YY hh:mm:ss'), | ||
computedOneHourAgo: ago('lastHour') | ||
computedOneHourAgo: ago('lastHour'), | ||
usIndependenceDay: new Date(1776, 6, 4, 12, 0, 0) | ||
}); |
@@ -11,14 +11,16 @@ import date from './date'; | ||
test('one arg (date)', function() { | ||
equal(moment(date(0), FAKE_HANDLEBARS_CONTEXT), '1969-12-31T19:00:00-05:00'); | ||
equal(moment(date(60*60*24), FAKE_HANDLEBARS_CONTEXT), '1969-12-31T19:01:26-05:00'); | ||
equal(moment(date(new Date(0)), FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:00 PM'); | ||
equal(moment(date(new Date(60*60*24)), FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:01 PM'); | ||
}); | ||
test('two args (date, outputFormat)', function() { | ||
equal(moment(date(0), 'LLLL', FAKE_HANDLEBARS_CONTEXT), '1969-12-31T19:00:00-05:00'); | ||
equal(moment(date(60*60*24), 'LLLL', FAKE_HANDLEBARS_CONTEXT), '1969-12-31T19:01:26-05:00'); | ||
equal(moment(date(new Date(0)), 'LLLL', FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:00 PM'); | ||
equal(moment(date(new Date(60*60*24)), 'LLLL', FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:01 PM'); | ||
equal(moment(Date.parse('2011-10-10T14:48:00-05:00'), 'MMMM D, YYYY', FAKE_HANDLEBARS_CONTEXT), 'October 10, 2011'); | ||
}); | ||
test('three args (date, outputFormat, inputFormat)', function() { | ||
equal(moment(date(0), 'LLLL', 'LLLL', FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:00 PM'); | ||
equal(moment(date(60*60*24), 'LLLL', 'LLLL', FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:01 PM'); | ||
equal(moment('October 10, 2011', 'LLLL', 'MMMM D, YYYY', FAKE_HANDLEBARS_CONTEXT), 'Monday, October 10, 2011 12:00 AM'); | ||
equal(moment('5/3/10', 'MMMM D, YYYY', 'M/D/YY', FAKE_HANDLEBARS_CONTEXT), 'May 3, 2010'); | ||
equal(moment(date(new Date(0)), 'LLLL', 'LLLL', FAKE_HANDLEBARS_CONTEXT), 'Wednesday, December 31, 1969 7:00 PM'); | ||
}); |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24510
57
464
1
1