diff options
Diffstat (limited to 'node_modules/to-iso-string')
-rw-r--r-- | node_modules/to-iso-string/.npmignore | 3 | ||||
-rw-r--r-- | node_modules/to-iso-string/History.md | 9 | ||||
-rw-r--r-- | node_modules/to-iso-string/Makefile | 17 | ||||
-rw-r--r-- | node_modules/to-iso-string/Readme.md | 18 | ||||
-rw-r--r-- | node_modules/to-iso-string/component.json | 9 | ||||
-rw-r--r-- | node_modules/to-iso-string/index.js | 40 | ||||
-rw-r--r-- | node_modules/to-iso-string/package.json | 11 | ||||
-rw-r--r-- | node_modules/to-iso-string/test/index.js | 10 |
8 files changed, 117 insertions, 0 deletions
diff --git a/node_modules/to-iso-string/.npmignore b/node_modules/to-iso-string/.npmignore new file mode 100644 index 000000000..665aa2197 --- /dev/null +++ b/node_modules/to-iso-string/.npmignore @@ -0,0 +1,3 @@ +components +build +node_modules diff --git a/node_modules/to-iso-string/History.md b/node_modules/to-iso-string/History.md new file mode 100644 index 000000000..f23b31e8c --- /dev/null +++ b/node_modules/to-iso-string/History.md @@ -0,0 +1,9 @@ + +0.0.2 - May 12, 2015 +-------------------- + +- Fix npm publish issue + +0.0.1 - October 16, 2013 +------------------------ +:sparkles: diff --git a/node_modules/to-iso-string/Makefile b/node_modules/to-iso-string/Makefile new file mode 100644 index 000000000..9600296b2 --- /dev/null +++ b/node_modules/to-iso-string/Makefile @@ -0,0 +1,17 @@ + +build: components node_modules + @component build --dev + +clean: + @rm -rf components build node_modules + +components: component.json + @component install --dev + +node_modules: package.json + @npm install + +test: build + @./node_modules/.bin/mocha --reporter spec + +.PHONY: clean test
\ No newline at end of file diff --git a/node_modules/to-iso-string/Readme.md b/node_modules/to-iso-string/Readme.md new file mode 100644 index 000000000..905b8d636 --- /dev/null +++ b/node_modules/to-iso-string/Readme.md @@ -0,0 +1,18 @@ + +# to-iso-string + + Cross-browser toISOString support. + +## Example + +```js +var iso = require('to-iso-string'); +var date = new Date("05 October 2011 14:48 UTC"); + +iso(date); +// "2011-10-05T14:48:00.000Z" +``` + +## License + + MIT
\ No newline at end of file diff --git a/node_modules/to-iso-string/component.json b/node_modules/to-iso-string/component.json new file mode 100644 index 000000000..f5270b58b --- /dev/null +++ b/node_modules/to-iso-string/component.json @@ -0,0 +1,9 @@ +{ + "name": "to-iso-string", + "repo": "segmentio/to-iso-string", + "version": "0.0.2", + "license": "MIT", + "description": "Cross-browser toISOString support.", + "keywords": ["iso", "format", "iso8601", "date", "isostring", "toISOString"], + "scripts": ["index.js"] +} diff --git a/node_modules/to-iso-string/index.js b/node_modules/to-iso-string/index.js new file mode 100644 index 000000000..4675691f1 --- /dev/null +++ b/node_modules/to-iso-string/index.js @@ -0,0 +1,40 @@ + +/** + * Expose `toIsoString`. + */ + +module.exports = toIsoString; + + +/** + * Turn a `date` into an ISO string. + * + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString + * + * @param {Date} date + * @return {String} + */ + +function toIsoString (date) { + return date.getUTCFullYear() + + '-' + pad(date.getUTCMonth() + 1) + + '-' + pad(date.getUTCDate()) + + 'T' + pad(date.getUTCHours()) + + ':' + pad(date.getUTCMinutes()) + + ':' + pad(date.getUTCSeconds()) + + '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5) + + 'Z'; +} + + +/** + * Pad a `number` with a ten's place zero. + * + * @param {Number} number + * @return {String} + */ + +function pad (number) { + var n = number.toString(); + return n.length === 1 ? '0' + n : n; +}
\ No newline at end of file diff --git a/node_modules/to-iso-string/package.json b/node_modules/to-iso-string/package.json new file mode 100644 index 000000000..71a7168a5 --- /dev/null +++ b/node_modules/to-iso-string/package.json @@ -0,0 +1,11 @@ +{ + "name": "to-iso-string", + "repository": "git://github.com/segmentio/to-iso-string.git", + "version": "0.0.2", + "license": "MIT", + "description": "Cross-browser toISOString support.", + "keywords": ["iso", "format", "iso8601", "date", "isostring", "toISOString"], + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/to-iso-string/test/index.js b/node_modules/to-iso-string/test/index.js new file mode 100644 index 000000000..11456b37f --- /dev/null +++ b/node_modules/to-iso-string/test/index.js @@ -0,0 +1,10 @@ + +var assert = require('assert'); +var iso = require('..'); + +describe('to-iso-string', function () { + it('should work', function () { + var date = new Date("05 October 2011 14:48 UTC"); + assert('2011-10-05T14:48:00.000Z' == iso(date)); + }); +});
\ No newline at end of file |