{"_id":"@dmonaldo/date-genie","_rev":"1-3d267e5f612375ad5d6629bf0d69c7d6","name":"@dmonaldo/date-genie","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.6":{"name":"@dmonaldo/date-genie","version":"1.0.6","description":"A date manipulation library. Use it to count the number of weeks or months that have occured since the Unix epoch.","keywords":["date","unix","epoch","util"],"main":"./genie.js","scripts":{"test":"TZ=UTC jest --passWithNoTests --watch","build":"tsc","dist":"gulp","postpublish":"npm publish --ignore-scripts --access public --@dmonaldo:registry='https://registry.npmjs.org'"},"repository":{"type":"git","url":"git+https://github.com/dmonaldo/date-genie.git"},"publishConfig":{"registry":"https://npm.pkg.github.com/"},"author":{"name":"Dante Monaldo","email":"mail@dantemonaldo.com","url":"https://dantemonaldo.com"},"license":"ISC","devDependencies":{"@types/jest":"^24.0.21","gulp":"^4.0.2","gulp-concat":"^2.6.1","gulp-uglify":"^3.0.2","jest":"^24.9.0","ts-jest":"^24.1.0","typescript":"^3.6.4"},"gitHead":"7d22d171379525f5c45e49809d238e7db4fdb930","bugs":{"url":"https://github.com/dmonaldo/date-genie/issues"},"homepage":"https://github.com/dmonaldo/date-genie#readme","_id":"@dmonaldo/date-genie@1.0.6","_nodeVersion":"12.10.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-GIm61r8xQ/9BqCz6m5aw3A49Q2nicXJseC2PeVDHY9oDPGxPr8I6saItU8NKhVz4YqbIBOFrjah203Tj7NSn4A==","shasum":"7fbd82b40307a71ed2d27677ef766803c1a526b3","tarball":"https://registry.npmjs.org/@dmonaldo/date-genie/-/date-genie-1.0.6.tgz","fileCount":11,"unpackedSize":81304,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd2LivCRA9TVsSAnZWagAAn28QAIUfN4jqACzYHGLSwl1l\n6pxBqzHCBPOrHWePX24haqR5s8Ze0uPppVivN6zuV38+MR7GpZ31Bt7DJHq6\nKfHce66bSGGBcny1f72PR9Xp9SwGZ2BlqH7PgR1AC6d921AR5gJIDPzlL5Us\nvwl72rYea8chA00jUjuuYBYt9Z8pYsspLaIMKqxwvWO3VTUXR3I90oZnfd7h\ndfT8meQWDuTId64y/dUgrVVhzXbWg5BbbRRftQ/l/11nzBPBZPN33TXOJIo2\naSPCd1RkVa6gBFvyV6OF4XLdtUUC/I63HD+p0Mo1Xl+J4uiJ0Q1gpJ8qGMhF\nGj6J6/QAsfXN7L9lqeHXZTLhM6sX8o2Ld+OjP6Y93KyxO+pd+O37WtPcm/HL\nCada2LglYDKyvPLHPlqXLQXVEc+282uSmFJuOT8Fv0Wa0q7TA5+BCdAJABxc\nAF1+PU8H78q2XnWVe5lgmcgn384vKpt6hMY7s7oBLFs8RRdZLBeXc0h1deCp\nJpIFquFfCxizqMYxSBIS8ENsj7braAV92kpGHMJxpqGJFPv19kl83Z3IcHgN\nNXArQJ0YdGurd/jsMNZ+2iXBBD8RrCRjP3R5EGY714xxNb6HE1DVCqFPmJWw\nzVbbvfISTYOT0gfy6edc9Lfy9xfOdmhjcy5nFfViDidrqMA4vnOsU6BblrV2\n5JxV\r\n=Z3wH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBTIgIrgWGDCuT2DzwpA1oRmeak8tzxmkttWi6hWKN/1AiARSK0JHobolbOz1dfwdG1ZFneEj6gMu0I3GqSewu3V9A=="}]},"maintainers":[{"name":"dmonaldo","email":"dante.monaldo@gmail.com"}],"_npmUser":{"name":"dmonaldo","email":"dante.monaldo@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/date-genie_1.0.6_1574484143179_0.20393325582601762"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-23T04:42:22.940Z","1.0.6":"2019-11-23T04:42:23.327Z","modified":"2022-04-05T05:00:17.724Z"},"maintainers":[{"name":"dmonaldo","email":"dante.monaldo@gmail.com"}],"description":"A date manipulation library. Use it to count the number of weeks or months that have occured since the Unix epoch.","homepage":"https://github.com/dmonaldo/date-genie#readme","keywords":["date","unix","epoch","util"],"repository":{"type":"git","url":"git+https://github.com/dmonaldo/date-genie.git"},"author":{"name":"Dante Monaldo","email":"mail@dantemonaldo.com","url":"https://dantemonaldo.com"},"bugs":{"url":"https://github.com/dmonaldo/date-genie/issues"},"license":"ISC","readme":"# date-genie\ndate-genie is a Javascript date manipulation library written in Typescript. Use it to count the number of weeks or months that have occured since the Unix epoch.\n\n###### Disclaimer\nThis library has been thoroughly tested in UTC (Zulu Time) environments. Running this code in a timezone other than UTC *could* produce unpredictable results.\n\n## Installation\nUse the package manager [npm](https://www.npmjs.com/package/@dmonaldo/date-genie) to install date-genie.\n\n```bash\nnpm install date-genie\n```\n\n## Usage\n```javascript\nimport genie from 'date-genie';\n```\n\n#### getWeek(Date, TimezoneOffset)\nProvided a given `Date`, return the number of full weeks that have occured before this date + 1. Monday is considered the first day of the week.\n\n`TimezoneOffset` is optional. If supplied, it shifts the date to the specified timezone using the offset. Otherwise it defaults to `0`.\n\n```javascript\n// Tuesday, November 5th, 2019\nvar date = new Date(\"2019-11-05T00:00:00.000Z\"); \nvar result = genie.getWeek(date);\n// result = 2601 because November 5th, 2019 is in the 2601st week since the Unix epoch\n```\n\n```javascript\n// Using TimezoneOffset\n// Sunday, November 3rd, 2019 @ 10pm PST\n// Note that the UTC date is November 4th but the TimezoneOffset shifts it back\nvar date = new Date(\"2019-11-04T06:00:00.000Z\");\nvar timezoneOffset = 480;\nvar result = genie.getWeek(date, timezoneOffset);\n// result = 2600 because November 3rd, 2019 is in the 2600th week since the Unix epoch\n```\n\n#### getMonth(Date, TimezoneOffset)\nProvided a given `Date`, return the number of full months that have occured before this date + 1.\n\n`TimezoneOffset` is optional. If supplied, it shifts the date to the specified timezone using the offset. Otherwise it defaults to `0`.\n\n```javascript\n// Friday, November 1st, 2019\nvar date = new Date(\"2019-11-01T00:00:00.000Z\"); \nvar result = genie.getMonth(date);\n// result = 599 because November 2019 is the 599th month since the Unix epoch\n```\n\n## Roadmap\n- Add support for dates before 1970. Currently only dates after January 1st, 1970 are supported and have been tested.\n- Allow the day a week starts to be adjusted for `getWeek`. Currently defaults to Monday.\n- Support environments operating in timezones other than UTC.\n- Solve [Year 2038 problem](https://en.wikipedia.org/wiki/Year_2038_problem)\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to add/update tests as appropriate.\n\n```bash\n# Build and run tests\nnpm test\n\n# Compile TypeScript into ./build\ntsc\n\n# Build for distribution\ngulp\n```\n\n## License\n[ISC](https://choosealicense.com/licenses/isc/)","readmeFilename":"README.md"}