ractive-datetime
Advanced tools
Comparing version 0.1.1 to 1.0.0
{ | ||
"name": "ractive-datetime", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"main": "ractive-datetime.js", | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
"dependencies": { | ||
"moment": "^2.11.2", | ||
"fecha": "^2.2.0", | ||
"ractive": "^0.7.3" | ||
@@ -19,0 +19,0 @@ }, |
/* | ||
* Formats a date using the specified format. | ||
*/ | ||
var moment = require('moment'); | ||
var fecha = require('fecha'); | ||
function datetime(date, format) { | ||
return moment(date).format(format); | ||
return fecha.format(date, format); | ||
} | ||
function fromNow(date) { | ||
return moment(date).fromNow(); | ||
} | ||
// Self-registering in Ractive: | ||
@@ -20,3 +16,2 @@ | ||
helpers.datetime = datetime; | ||
helpers.fromNow = fromNow; | ||
@@ -26,4 +21,3 @@ // Exporting for testing: | ||
module.exports = { | ||
datetime: datetime, | ||
fromNow: fromNow | ||
datetime: datetime | ||
} |
# Ractive Date/Time helper | ||
A date and time format mustache helper for [Ractive](http://www.ractivejs.org/), | ||
using [Moment.js](http://momentjs.com/) | ||
using [fecha](https://github.com/taylorhakes/fecha) | ||
@@ -40,12 +40,7 @@ ---- | ||
Full format options are [here](http://momentjs.com/docs/#/displaying/format/). | ||
Full format options are [here](https://github.com/taylorhakes/fecha#formatting-tokens). | ||
---- | ||
**Note: Relative dates using `fromNow` helper have been removed in version 1.x. to reduce dependency sizes.** | ||
If you need this, please use the older 0.1.x versions: | ||
### Relative dates: | ||
<h2>{{fromNow(some_past_date)}}</h2> | ||
#### Outputs: | ||
7 months ago | ||
`npm install ractive-datetime@0.1` |
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
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
1
4169
34
45
+ Addedfecha@^2.2.0
+ Addedfecha@2.3.3(transitive)
- Removedmoment@^2.11.2
- Removedmoment@2.30.1(transitive)