{"_id":"@ahmadawais/datemath","name":"@ahmadawais/datemath","dist-tags":{"latest":"1.2.0"},"versions":{"1.2.0":{"name":"@ahmadawais/datemath","version":"1.2.0","description":"A beautiful CLI for date calculations in natural language","type":"module","main":"./dist/index.js","bin":{"datemath":"dist/index.js"},"scripts":{"dev":"tsup --watch --onSuccess 'node dist/index.js'","build":"tsup","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","typecheck":"tsc --noEmit","lint":"eslint src","format":"prettier --write src"},"keywords":["cli","date","math","calculator","time"],"author":{"name":"Ahmad Awais","email":"me@ahmadawais.com","url":"https://ahmadawais.com"},"repository":{"type":"git","url":"git+https://github.com/ahmadawais/datemath.git"},"bugs":{"url":"https://github.com/ahmadawais/datemath/issues"},"homepage":"https://github.com/ahmadawais/datemath#readme","license":"MIT","devDependencies":{"@types/gradient-string":"^1.1.6","@types/node":"^20.10.5","@vitest/coverage-v8":"^3.2.4","tsup":"^8.0.1","typescript":"^5.3.3","vitest":"^3.2.4"},"dependencies":{"@clack/prompts":"^0.7.0","chalk":"^5.3.0","commander":"^11.1.0","gradient-string":"^2.0.2","ora":"^8.0.1"},"gitHead":"a0f302aa68d975eb2d71d9d081493bd234204268","types":"./dist/index.d.ts","_id":"@ahmadawais/datemath@1.2.0","_nodeVersion":"22.18.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-vyEaFd9jnWH11tSx3nAZvh2kxHM+PM5jrtdBJmXknFfpEow+6bt82+qrtSp/dLWfvX12I8jPl2HN/F3eEu6uGw==","shasum":"2ee17e54e8001c329c14dd8332838a4324386a41","tarball":"https://registry.npmjs.org/@ahmadawais/datemath/-/datemath-1.2.0.tgz","fileCount":4,"unpackedSize":24340,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFsH4vqKAVgwghTnv/RhuorvJyV7rz08ysYIEj3bmoHMAiEAixI9R+8ziT8nQN6cm8axDFdrdPYN/YfMOF5s2yJ+xiU="}]},"_npmUser":{"name":"ahmadawais","email":"me@ahmadawais.com"},"directories":{},"maintainers":[{"name":"ahmadawais","email":"me@ahmadawais.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/datemath_1.2.0_1760821548807_0.9576981157649429"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-18T21:05:48.662Z","1.2.0":"2025-10-18T21:05:49.004Z","modified":"2025-10-18T21:05:49.427Z"},"maintainers":[{"name":"ahmadawais","email":"me@ahmadawais.com"}],"description":"A beautiful CLI for date calculations in natural language","homepage":"https://github.com/ahmadawais/datemath#readme","keywords":["cli","date","math","calculator","time"],"repository":{"type":"git","url":"git+https://github.com/ahmadawais/datemath.git"},"author":{"name":"Ahmad Awais","email":"me@ahmadawais.com","url":"https://ahmadawais.com"},"bugs":{"url":"https://github.com/ahmadawais/datemath/issues"},"license":"MIT","readme":"# 📅 DateMath CLI\n\nA beautiful command-line tool for date calculations in natural language. Calculate days between dates, add/subtract time periods, and get human-readable date information.\n\n[![Version](https://img.shields.io/npm/v/datemath.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=000&color=fff)](https://www.npmjs.com/package/datemath)\n[![License](https://img.shields.io/badge/license-MIT-fff?style=for-the-badge&labelColor=000&color=fff)](LICENSE)\n[![Downloads](https://img.shields.io/npm/dt/datemath.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=000&color=fff)](https://www.npmjs.com/package/datemath)\n\n![DateMath CLI Demo](demo.svg)\n\n## ✨ Features\n\n- 🎨 Beautiful gradient ASCII art welcome screen\n- 📊 Calculate days/weeks/months/years between dates\n- ➕ Add or subtract time periods from dates\n- 🗓️ Display dates in human-readable format\n- 💬 Interactive calculator mode\n- ⚡ Fast and lightweight\n- 🎯 Type-safe TypeScript implementation\n- ✅ Comprehensive test coverage\n\n## 🚀 Installation\n\n### Global Installation (Recommended)\n\n```bash\nnpm install -g datemath\n```\n\n### Local Development\n\n```bash\nnpm install\nnpm run dev\n```\n\n### Use with npx (No Installation)\n\n```bash\nnpx datemath <command>\n```\n\n## 📖 Usage\n\n### Show Today's Date\n\n```bash\ndatemath today\n```\n\n**Output:**\n```\n📅 Today is:\nFriday, October 17, 2025\nISO format: 2025-10-17\n```\n\n### Calculate Days Since a Date\n\n```bash\ndatemath since 2025-01-01\n```\n\n**Output:**\n```\n📊 Time since Wednesday, January 1, 2025:\n289 days\n```\n\nWith verbose output:\n```bash\ndatemath since 2025-01-01 -v\n```\n\n**Output:**\n```\n📊 Time since Wednesday, January 1, 2025:\n289 days\n  = 41 weeks\n  = 9 months, 19 days\n```\n\n### Calculate Days Until a Date\n\n```bash\ndatemath to 2025-12-25\n```\n\n**Output:**\n```\n📊 Time until Thursday, December 25, 2025:\n69 days\n```\n\nAlias:\n```bash\ndatemath until 2025-12-25\n```\n\n### Calculate Time Between Two Dates\n\n```bash\ndatemath between 2025-01-01 2025-10-17\n```\n\n**Output:**\n```\n📊 Time between Wednesday, January 1, 2025 and Friday, October 17, 2025:\n289 days\n```\n\nWith specific unit:\n```bash\ndatemath between 2025-01-01 2025-10-17 --unit weeks\n```\n\n**Output:**\n```\n41 weeks\n```\n\nShow all units:\n```bash\ndatemath between 2025-01-01 2025-10-17 -v\n```\n\n**Output:**\n```\n📊 Time between Wednesday, January 1, 2025 and Friday, October 17, 2025:\n  289 days\n  41 weeks\n  9 months\n  0 years\n  9 months, 19 days\n```\n\n### Add Time to a Date\n\n```bash\ndatemath add 2025-10-17 30 days\ndatemath add 2025-10-17 5 weeks\ndatemath add 2025-10-17 2 months\ndatemath add 2025-10-17 1 year\n```\n\n**Output:**\n```\n📊 Friday, October 17, 2025 + 30 days:\nSaturday, November 16, 2025\nISO format: 2025-11-16\n```\n\n### Subtract Time from a Date\n\n```bash\ndatemath subtract 2025-10-17 30 days\ndatemath sub 2025-10-17 5 weeks\n```\n\n**Output:**\n```\n📊 Friday, October 17, 2025 - 30 days:\nThursday, September 17, 2025\nISO format: 2025-09-17\n```\n\n### Interactive Calculator Mode\n\n```bash\ndatemath calc\n```\n\nThis launches an interactive prompt where you can:\n- Choose the type of calculation\n- Enter dates step-by-step\n- Get instant results with beautiful formatting\n\n## 🎯 Command Reference\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `today` | Show today's date | `datemath today` |\n| `since <date>` | Days since a date | `datemath since 2025-01-01` |\n| `to <date>` | Days until a date | `datemath to 2025-12-25` |\n| `until <date>` | Alias for `to` | `datemath until 2025-12-25` |\n| `between <date1> <date2>` | Time between dates | `datemath between 2025-01-01 2025-10-17` |\n| `add <date> <amount> <unit>` | Add time to date | `datemath add 2025-01-01 30 days` |\n| `subtract <date> <amount> <unit>` | Subtract time from date | `datemath sub 2025-01-01 30 days` |\n| `calc` | Interactive calculator | `datemath calc` |\n\n### Options\n\n- `-v, --verbose` - Show detailed breakdown (for `since`, `to`, `between`)\n- `-u, --unit <unit>` - Specify unit: days, weeks, months, years (for `between`)\n- `-h, --help` - Show help\n- `-V, --version` - Show version\n\n### Date Format\n\nAll dates must be in **ISO 8601 format**: `YYYY-MM-DD`\n\nExamples:\n- `2025-10-17` ✅\n- `2025-01-01` ✅\n- `10/17/2025` ❌\n- `17-10-2025` ❌\n\n### Time Units\n\nSupported units for add/subtract commands:\n- `day` or `days`\n- `week` or `weeks`\n- `month` or `months`\n- `year` or `years`\n\n## 🛠️ Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/ahmadawais/datemath.git\ncd datemath\n\n# Install dependencies\nnpm install\n\n# Run in development mode\nnpm run dev\n```\n\n### Available Scripts\n\n```bash\nnpm run dev          # Run in development mode with watch\nnpm run build        # Build for production\nnpm test            # Run tests once\nnpm run test:watch   # Run tests in watch mode\nnpm run test:coverage # Run tests with coverage report\nnpm run typecheck    # Type check without emitting\nnpm run lint         # Lint code\nnpm run format       # Format code with Prettier\n```\n\n### Project Structure\n\n```\ndatemath/\n├── src/\n│   ├── index.ts         # Main CLI entry point\n│   └── index.test.ts    # Test suite\n├── dist/                # Compiled output (generated)\n├── package.json         # Dependencies and scripts\n├── tsconfig.json        # TypeScript configuration\n├── tsup.config.ts       # Build configuration\n├── vitest.config.ts     # Test configuration\n└── README.md            # This file\n```\n\n### Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Watch mode (re-runs on file changes)\nnpm run test:watch\n\n# Coverage report\nnpm run test:coverage\n```\n\n### Building\n\n```bash\n# Build the project\nnpm run build\n\n# Test the built version locally\nnpm link\ndatemath today\n```\n\n## 📦 Publishing\n\n```bash\n# Update version\nnpm version patch  # or minor, or major\n\n# Build\nnpm run build\n\n# Publish to npm\nnpm publish\n\n# Push tags to git\ngit push --tags\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 👨‍💻 Author\n\n**Ahmad Awais** - [Website](https://ahmadawais.com) · [GitHub](https://github.com/ahmadawais) · [Twitter](https://twitter.com/MrAhmadAwais)\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- Built with [Commander.js](https://github.com/tj/commander.js)\n- Beautiful prompts by [@clack/prompts](https://github.com/natemoo-re/clack)\n- Styled with [Chalk](https://github.com/chalk/chalk) and [gradient-string](https://github.com/bokub/gradient-string)\n\n## 📧 Support\n\nIf you have any questions or run into issues, please [open an issue](https://github.com/ahmadawais/datemath/issues) on GitHub.\n\n---\n\nMade with 💜 by [Ahmad Awais](https://ahmadawais.com)\n","readmeFilename":"README.md","_rev":"1-3df0ec080e958f68207b251e4c6f8b0a"}