{"name":"nano-date","version":"2.0.0","description":"Date class that supports up to nano seconds","main":"lib/index.js","scripts":{"rollup":"BABEL_ENV=rollup rollup -c","compile":"BABEL_ENV=npm babel src/ --out-dir lib","prepublish":"npm run compile && npm run rollup","test":"BABEL_ENV=development jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/jcgertig/nano-date.git"},"jest":{"testPathIgnorePatterns":["/node_modules/","<rootDir>/lib/","<rootDir>/build/","<rootDir>/examples/"]},"keywords":["nano","date","timestamp","nanoseconds","miliseconds","microseconds","time","year","day","month"],"author":{"name":"jcgertig","email":"jcgertig@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/jcgertig/nano-date/issues"},"homepage":"https://github.com/jcgertig/nano-date#readme","dependencies":{"bignumber.js":"^4.0.4","core-decorators":"^0.20.0","memoizerific":"^1.11.2"},"devDependencies":{"babel-cli":"^6.26.0","babel-jest":"^20.0.3","babel-plugin-external-helpers":"^6.22.0","babel-plugin-transform-decorators-legacy":"^1.3.4","babel-plugin-transform-es2015-modules-umd":"^6.24.1","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1","jest":"^20.0.4","regenerator-runtime":"^0.11.0","rollup":"^0.49.2","rollup-plugin-babel":"^3.0.2","rollup-plugin-commonjs":"^8.2.0","rollup-plugin-node-resolve":"^3.0.0","rollup-plugin-replace":"^1.1.1","rollup-plugin-uglify":"^2.0.1"},"gitHead":"5e08671dc60aa49b4fbc12b7c6a147df399324bc","_id":"nano-date@2.0.0","_shasum":"a5c85d28186aaef8422de69bde4d4d346623c304","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"jcgertig","email":"jcgertig@gmail.com"},"dist":{"shasum":"a5c85d28186aaef8422de69bde4d4d346623c304","tarball":"http://registry-npm.ywwl.com/nano-date/download/nano-date-2.0.0.tgz","integrity":"sha512-R5y1JKh+uIG/xd3a0Z70naMQ+1uouLcPfd7ziWofTXb6Snv0DfxmyDBywW8b3nV1nUNo2PJ7pvv2e0ZdeTEykg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2l4U+elr0UdEC8whXgKERe79ia5+47hSWNvFeOdaXqwIgT+cK7GX0OFr/ow/VDqd0qucXkqgewks7l9ZXCHOtVbw="}],"size":107652,"noattachment":false,"key":"/nano-date/-/nano-date-2.0.0.tgz"},"maintainers":[{"name":"jcgertig","email":"jcgertig@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nano-date-2.0.0.tgz_1504498875498_0.390889992704615"},"directories":{},"readme":"# Nano Date\n\n[![Downloads][npm-dm]][package-url]\n[![Downloads][npm-dt]][package-url]\n[![NPM Version][npm-v]][package-url]\n[![Dependencies][deps]][package-url]\n[![Dev Dependencies][dev-deps]][package-url]\n[![License][license]][package-url]\n[![Build Status](https://travis-ci.org/jcgertig/nano-date.svg?branch=master)](https://travis-ci.org/jcgertig/nano-date)\n[![Code Climate](https://codeclimate.com/github/jcgertig/nano-date/badges/gpa.svg)](https://codeclimate.com/github/jcgertig/nano-date)\n[![Test Coverage](https://codeclimate.com/github/jcgertig/nano-date/badges/coverage.svg)](https://codeclimate.com/github/jcgertig/nano-date/coverage)\n\n__Date class that supports up to nano seconds__\n\nAll of the normal date class functions with a few addtions.\n\nIf you pass a number in the constructor it will assume milliseconds however if\nyou pass in a string of numbers it will assume nanoseconds.\n\n```javascript\nconst upToMillisecondPrecision  = new NanoDate(1497290225089); // assumes milliseconds\nconst upToMicrosecondPrecision  = new NanoDate(1497290225089.999); // assumes milliseconds\nconst upToNanosecondPrecision = new NanoDate('1497290225089999999'); // assumes nanoseconds\n```\n\n__Why a string of numbers?__\nThis is because 13 digits is ~ the max you can have in javascript and not have it start rounding off and 16 digits is ~ the max you can have in a float before it too starts to round.\nSo for our case of nanoseconds it needs up to 19 digits or more to represent time since epoch\nthat goes far beyond what a integer or float can handle so we have to use strings. Under the hood we use a library called bignumber.js to handle the math we do on this number.\n\nExtra available methods.\n\n- `getMicroseconds`\n```javascript\nnanoDate.getMicroseconds(); // 0 - 999\n```\n\n- `getNanoseconds`\n```javascript\nnanoDate.getNanoseconds(); // 0 - 999\n```\n\n- `setMicroseconds` - returns the microseconds value\n```javascript\nnanoDate.setMicroseconds(25); // 25\n```\n\n- `setNanoseconds` - returns the nanoseconds value\n```javascript\nnanoDate.setNanoseconds(25); // 25\n```\n\n- `toString`, `toUTCString` & `toISOStringFull` - adds millisecond, microsecond, nanosecond as a decimal to the seconds\n```javascript\nnanoDate.toString(); // ie \"Mon Jun 12 2017 12:57:05.089999999 GMT-0500 (CDT)\"\n```\n\n- `valueOf` && `NanoDate.now()` - returns a integer of millisecond precision\n\n- `valueOfWithMicro` - returns a float with microsecond precision\n```javascript\nnanoDate.valueOfWithMicro(); // 1497290225089.999\n```\n\n- `valueOfWithNano` - returns a float in a string with nanosecond precision\n```javascript\nnanoDate.valueOfWithNano(); // \"1497290225089.999999\"\n```\n\n- `getTime` - returns a string in nanoseconds\n```javascript\nnanoDate.getTime(); // \"1497290225089999999\"\n```\n\n[npm-dm]: https://img.shields.io/npm/dm/nano-date.svg\n[npm-dt]: https://img.shields.io/npm/dt/nano-date.svg\n[npm-v]: https://img.shields.io/npm/v/nano-date.svg\n[deps]: https://img.shields.io/david/jcgertig/nano-date.svg\n[dev-deps]: https://img.shields.io/david/dev/jcgertig/nano-date.svg\n[license]: https://img.shields.io/npm/l/nano-date.svg\n[package-url]: https://npmjs.com/package/nano-date\n","publish_time":1504498876692,"_cnpm_publish_time":1504498876692,"dist-tags":{"latest":"4.1.0"}}