Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easy-date

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-date - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

4

bower.json
{
"name": "easy-date",
"main": "easy-date.js",
"version": "0.9.0",
"version": "0.9.1",
"homepage": "https://github.com/melvinsembrano/easy-date",

@@ -9,3 +9,3 @@ "authors": [

],
"description": "A Javascript plugin for easy date manipulation.",
"description": "EasyDate is a Javascript extension for easy dates manipulations which is heavily inspired by Rails ActiveSupport::Duration class.",

@@ -12,0 +12,0 @@ "keywords": [

/*!
easy-date 0.1.1
Description: A Javascript plugin for easy date manipulation.
easy-date 0.9.1
Description: EasyDate is a Javascript extension for easy dates manipulations which is heavily inspired by Rails ActiveSupport::Duration class.
Author: Melvin Sembrano <melvinsembrano@gmail.com> (https://github.com/melvinsembrano/easy-date)
*/
(function(){var a,b,c,d,e;a=function(a,b){var c;c={0:"day",1:"week",2:"month",3:"year",4:"hour"},this.value=parseInt(a),this.type=c[b]},a.prototype.toString=function(){return this.value+" "+this.type+(this.value>1?"s":"")},a.prototype.fromNow=function(){switch(this.type){case"day":return this._daysFromNow();case"month":return this._monthsFromNow();case"year":return this._yearsFromNow();case"hour":return this._hoursFromNow();default:return console.warn("EasyDate: "+this.type+"().fromNow() not yet implemented.")}},a.prototype.ago=function(){switch(this.type){case"day":return this._daysAgo();case"month":return this._monthsAgo();case"year":return this._yearsAgo();case"hour":return this._hoursAgo();default:return console.warn("EasyDate: "+this.type+"().ago() not yet implemented.")}},a.prototype.since=function(a){return this.now=new Date(a.valueOf()),this.fromNow()},a.prototype.until=function(a){return this.now=new Date(a.valueOf()),this.ago()},a.prototype._daysFromNow=function(){var a;return a=this.now||new Date,a.setDate(a.getDate()+this.value),a},a.prototype._daysAgo=function(){var a;return a=this.now||new Date,a.setDate(a.getDate()-this.value),a},a.prototype._monthsFromNow=function(){var a;return a=this.now||new Date,a.setMonth(a.getMonth()+this.value),a},a.prototype._monthsAgo=function(){var a;return a=this.now||new Date,a.setMonth(a.getMonth()-this.value),a},a.prototype._yearsFromNow=function(){var a;return a=this.now||new Date,a.setFullYear(a.getFullYear()+this.value),a},a.prototype._yearsAgo=function(){var a;return a=this.now||new Date,a.setFullYear(a.getFullYear()-this.value),a},a.prototype._hoursFromNow=function(){var a;return a=this.now||new Date,a.setHours(a.getHours()+this.value),a},a.prototype._hoursAgo=function(){var a;return a=this.now||new Date,a.setHours(a.getHours()-this.value),a},b=function(){return new a(this,0)},d=function(){return new a(this,2)},e=function(){return new a(this,3)},c=function(){return new a(this,4)},Number.prototype.day=b,Number.prototype.days=b,Number.prototype.month=d,Number.prototype.months=d,Number.prototype.years=e,Number.prototype.year=e,Number.prototype.hours=c,Number.prototype.hour=c}).call(this);
{
"name": "easy-date",
"main": "easy-date.js",
"description": "A Javascript plugin for easy date manipulation.",
"version": "0.9.0",
"description": "EasyDate is a Javascript extension for easy dates manipulations which is heavily inspired by Rails ActiveSupport::Duration class.",
"version": "0.9.1",
"repository": {

@@ -7,0 +7,0 @@ "type": "git",

[![Build Status](https://travis-ci.org/melvinsembrano/easy-date.svg?branch=master)](https://travis-ci.org/melvinsembrano/easy-date)
# EasyDate
EasyDate is a Javascript extension for easy Dates manipulations.
EasyDate is a Javascript extension for easy dates manipulations which is
heavily inspired by Rails ActiveSupport::Duration class.
### Installation
TODO
**Node.js** `npm install easy-date --save-dev`
**Bower** `bower install easy-date`
[**Download the latest**](https://github.com/melvinsembrano/easy-date/archive/master.zip)
### Usage
TODO
**Node.js**
```
require('easy-date');
```
**In Browser**
```
<script src="easy-date.js"></script>
```
**Quickstart usage:**
### Contributing
TODO
by adding the codes above, new methods are now available on all numbers:
* day(), days()
* month(), months()
* year(), years()
* hour(), hours()
```
var date1 = 3..days().fromNow();
var date2 = 10..months().ago();
var yesterday = 1..day().ago();
var today = new Date();
var num = 5;
num.years().until(today); //==> is equal to 5..years().ago()
num.years().since(today); //==> is equal to 5..years().fromNow()
```
#### Contributing to easy-date
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Gruntfile, package.json, travis.yml, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
##### Copyright
Copyright (c) 2015 Melvin Sembrano. See [LICENSE](LICENSE) for further details
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc