From: Tim Wood Date: Thu, 9 Jun 2011 18:06:32 +0000 (-0700) Subject: working on readme X-Git-Tag: 0.5.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bda0b1748359b7e1c2bcc8a4a7f9fbfb97a5f20e;p=thirdparty%2Fmoment.git working on readme --- diff --git a/README.markdown b/README.markdown index 394d984ed..468cb622a 100755 --- a/README.markdown +++ b/README.markdown @@ -5,46 +5,35 @@ Author: Tim Wood Version: 0.5.0 -Note: There are some api changes that will break your code when upgrading from 0.4.1 to 0.5.0. Read about the changes at TODO:Add Link +*Note:* There are some api changes that will break your code when upgrading from 0.4.1 to 0.5.0. Read about the changes at TODO:Add Link -Underscore.date is a JavaScript Date library that manipulates and formats dates without extending the Date prototype. +Underscore.date is a javascript date library that helps create, manipulate, and format dates without extending the `Date` prototype. -It adds utility functions for working with Date objects without extending `Date.prototype`. +### 1.82 kb (min + gzip) -In addition to the date creation and manipulation functions, there are a few functions for displaying a date in human readable formats. - - var someday = new Date(2010, 1, 14, 15, 25, 50, 125); - _date(someday).format("dddd, MMMM Do YYYY, h:mm:ss a"); // "Sunday, February 14th 2010, 3:25:50 pm" - _date(someday).fromNow(); // "20 days ago" +Where to use it +=============== -### Filesize : 1.82 kb minified + gzipped - - - - - - - - - -
minifiedgzipped
4.21 kb1.82 kb
+### Node.js -Node.js -======= +Install with npm npm install underscore.date Usage var _date = require('underscore.date'); - console.log(_date.date('September 9 1999').fromNow()); + console.log(_date('September 9 1999').fromNow()); + +### In the browser + + _date('September 9 1999').fromNow() -Underscore mixin -================ +#### With underscore -If underscore exists, `_date` will mix itself into the underscore namespace, so you can do this: +If underscore - _.date('September 9 1999').fromNow() + _date('September 9 1999').fromNow() Otherwise, you should use `_date`.