Comparing version 0.1.2 to 0.1.3
@@ -62,2 +62,29 @@ // == BDS2 LICENSE == | ||
/* | ||
* Is this a valid date? | ||
* | ||
* @ param {String} timestamp | ||
* | ||
* @ return {Boolean} | ||
*/ | ||
isValidDate: function(timestamp) { | ||
var m = usedMoment(timestamp); | ||
// Be careful, if `value` is empty, `m` can be null | ||
return m && m.isValid(); | ||
}, | ||
/* | ||
* How long ago is this date from now | ||
* | ||
* @ param {String} timestamp | ||
* @ param {String} period years, months, weeks, days, hours, minutes, and seconds | ||
* | ||
* @ return {Number} | ||
*/ | ||
timeAgo: function(timestamp,period) { | ||
if(period){ | ||
var today = usedMoment(); | ||
return today.diff(timestamp, period); | ||
} | ||
return null; | ||
}, | ||
/* | ||
* Format the given timestamp for storage | ||
@@ -64,0 +91,0 @@ * |
{ | ||
"name": "sundial", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Tidepool's datetime wrapper", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
5594
126