{"id":18445686,"url":"https://github.com/danielcoderx/dtd","last_synced_at":"2025-06-11T15:04:53.262Z","repository":{"id":159915283,"uuid":"634924636","full_name":"DanielcoderX/dtd","owner":"DanielcoderX","description":"Date Time Difference module for crystal language","archived":false,"fork":false,"pushed_at":"2023-06-12T14:29:46.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T01:14:47.337Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielcoderX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-01T15:02:49.000Z","updated_at":"2024-10-19T12:08:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9b400ac-13e7-4e1d-8651-9be60c61ee9f","html_url":"https://github.com/DanielcoderX/dtd","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielcoderX%2Fdtd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielcoderX%2Fdtd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielcoderX%2Fdtd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielcoderX%2Fdtd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielcoderX","download_url":"https://codeload.github.com/DanielcoderX/dtd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986316,"owners_count":21194025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:06:53.620Z","updated_at":"2025-04-15T01:14:51.381Z","avatar_url":"https://github.com/DanielcoderX.png","language":"Crystal","readme":"# dtd\n\nThis module provides a convenient way to calculate the difference between two dates in days, months, and years. It also offers the ability to calculate the difference between two times in hours, minutes, and seconds. It offers a simple and effective solution for performing date and time calculations in Crystal applications.\n\n## Installation\n\n1. Add the `dtd` dependency to your `shard.yml` file:\n\n   ```yaml\n   dependencies:\n     dtd:\n       github: danielcoderx/dtd\n   ```\n\n2. Run `shards install` to fetch the dependency.\n\n## Usage\n\n### Date Difference\n\n```crystal\nrequire \"dtd\"\n\ndate1 = \"2022/04/30\"\ndate2 = \"2022/05/01\"\n\nresult = Dtd.date_diff(date1, date2)\n\nputs \"Difference: #{result[\"years\"]} years, #{result[\"months\"]} months, #{result[\"days\"]} days\"\n```\n\n### Time Difference\n\n```crystal\nrequire \"dtd\"\n\ntime1 = \"2022/05/01 10:30:00\"\ntime2 = \"2022/05/01 12:45:30\"\n\nresult = Dtd.time_diff(time1, time2)\n\nputs \"Difference: #{result[\"hours\"]} hours, #{result[\"minutes\"]} minutes, #{result[\"seconds\"]} seconds\"\n```\n\n## Features\n\n- Calculates the difference between two dates in days, months, and years.\n- Calculates the difference between two times in hours, minutes, and seconds.\n- Supports custom time zones for accurate calculations.\n- Returns a Hash that provides the difference in years, months, days, hours, minutes, and seconds.\n- Handles scenarios where the second date or time is before the first date or time.\n- Provides error messages when necessary.\n\n## TODO\n\n- Enhance error handling and error messages.\n- Add support for accepting various input formats.\n- Improve overall performance and efficiency.\n\n## Contributing\n\n1. Fork the repository from [https://github.com/danielcoderx/dtd](https://github.com/danielcoderx/dtd).\n2. Create your feature branch: `git checkout -b my-new-feature`.\n3. Commit your changes: `git commit -am 'Add some feature'`.\n4. Push the branch to your forked repository: `git push origin my-new-feature`.\n5. Create a new Pull Request.\n\n## Contributors\n\n- [danielcoderx](https://github.com/danielcoderx) - Creator and maintainer\n\nYour contributions to this project are highly appreciated! If you have any suggestions, bug reports, or feature requests, please don't hesitate to open an issue or submit a pull request. Let's work together to make `dtd` even better!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcoderx%2Fdtd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielcoderx%2Fdtd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcoderx%2Fdtd/lists"}