{"_id":"@dennisk2025/date-difference-calculator","name":"@dennisk2025/date-difference-calculator","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@dennisk2025/date-difference-calculator","version":"1.0.0","description":"Calculates the difference between two dates, returning the duration in years, months, days, hours, minutes, and seconds.","type":"module","main":"index.js","bin":{"date-difference-calculator":"index.js"},"dependencies":{"@modelcontextprotocol/sdk":"latest"},"author":{"name":"dennisk2025"},"license":"MIT","_id":"@dennisk2025/date-difference-calculator@1.0.0","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-p76cAFtthGzVsCSB+zOq7dyBDpYGXCd36qRazl5j7BywNgvbGmitKNdAl8z7USKHCr0fJ3Vn0DZT6J7Hh8tZog==","shasum":"0c5dfd3ba791bb3f98e87df19f8c57856d3bddb3","tarball":"https://registry.npmjs.org/@dennisk2025/date-difference-calculator/-/date-difference-calculator-1.0.0.tgz","fileCount":3,"unpackedSize":9167,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIChDUPHALNHSHkzCFE+UmMRdSODZ5l8gJ14bs0EIP43hAiEA1NEphawvO8m0hVWimLgI9LhmLN0H1qeG+h4rbt4QXZk="}]},"_npmUser":{"name":"dennisk2025","email":"4dennisk@gmail.com"},"directories":{},"maintainers":[{"name":"dennisk2025","email":"4dennisk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/date-difference-calculator_1.0.0_1761425045531_0.48407162316375296"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-25T20:44:05.468Z","1.0.0":"2025-10-25T20:44:05.730Z","modified":"2025-10-25T20:44:06.009Z"},"maintainers":[{"name":"dennisk2025","email":"4dennisk@gmail.com"}],"description":"Calculates the difference between two dates, returning the duration in years, months, days, hours, minutes, and seconds.","author":{"name":"dennisk2025"},"license":"MIT","readme":"# Date Difference Calculator MCP Server\n\nA Model Context Protocol (MCP) server for calculating the difference between two dates/times, returning the duration in years, months, days, hours, minutes, and seconds — plus total days, hours, minutes, and seconds. Perfect for utility tooling, time span queries, contest timers, or productivity use.\n\n## Features\n- **calculate_date_difference**: Computes precise time spans between any two dates/times in ISO 8601 format.\n- Returns both a breakdown by years, months, days, etc., and total units.\n- Robust error handling and production-grade edge case management.\n\n## Installation\n\nThe easiest way is via npx (no install needed):\n\n```\nnpx @dennisk2025/date-difference-calculator\n```\n\nOr, install system-wide or locally:\n\n```\nnpm install -g @dennisk2025/date-difference-calculator\n```\n\n## Using with Claude Desktop\n\nAdd the following snippet to your Claude Desktop config file:\n\n```json\n{\n  \"mcpServers\": {\n    \"date-diff\": {\n      \"command\": \"npx\",\n      \"args\": [\"@dennisk2025/date-difference-calculator\"]\n    }\n  }\n}\n```\n\nAdd this to your Claude Desktop config file at:\n- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n- **Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n## Available Tools\n\n### 1. calculate_date_difference\n\n**Description:** Given two dates in ISO 8601 format, computes the duration in years, months, days, hours, minutes, seconds, and as total days/hours/minutes/etc.\n\n**Parameters:**\n- `start_date` (string, ISO 8601, required): The start date (e.g., `2023-06-15T12:00:00Z`)\n- `end_date` (string, ISO 8601, required): The end date (e.g., `2024-01-01T00:00:00Z`)\n\n**Returns:**\n```\n{\n  \"start_date\": \"...\",\n  \"end_date\": \"...\",\n  \"swap\": false,  // true if \"start date\" and \"end date\" were reversed chronologically\n  \"duration\": {\n    \"years\": 0,\n    \"months\": 6,\n    \"days\": 16,\n    \"hours\": 12,\n    \"minutes\": 0,\n    \"seconds\": 0\n  },\n  \"total\": {\n    \"milliseconds\": 123456789,\n    \"seconds\": 123456,\n    \"minutes\": 2057,\n    \"hours\": 34,\n    \"days\": 1\n  }\n}\n```\n\n### Example Usage\n\n#### Minimal:\n```\n{\"start_date\": \"2023-06-15T12:00:00Z\", \"end_date\": \"2024-01-01T00:00:00Z\"}\n```\n\n#### Swapped (handles automatically):\n```\n{\"start_date\": \"2024-01-01T00:00:00Z\", \"end_date\": \"2023-06-15T12:00:00Z\"}\n```\n\n#### Millisecond resolution and leap years supported!\n\n## Troubleshooting\n- Dates **must** be valid ISO-8601 strings (with or without timezone, but UTC preferred, i.e., ending in `Z`).\n- If the `start_date` is after `end_date`, the output will be identical with the `swap` field noted.\n- All calculations are in UTC — for local time, please convert before sending to this server.\n\n## License\nMIT\n\n---\n\nEnjoy precision date difference calculations in any Model Context Protocol–enabled tool!","readmeFilename":"README.md","_rev":"1-a7da506400d41888686c49d2c02e98c6"}