dtd

This 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.

Installation

  1. Add the dtd dependency to your shard.yml file:

    dependencies:
      dtd:
        github: danielcoderx/dtd
  2. Run shards install to fetch the dependency.

Usage

Date Difference

require "dtd"

date1 = "2022/04/30"
date2 = "2022/05/01"

result = Dtd.date_diff(date1, date2)

puts "Difference: #{result["years"]} years, #{result["months"]} months, #{result["days"]} days"

Time Difference

require "dtd"

time1 = "2022/05/01 10:30:00"
time2 = "2022/05/01 12:45:30"

result = Dtd.time_diff(time1, time2)

puts "Difference: #{result["hours"]} hours, #{result["minutes"]} minutes, #{result["seconds"]} seconds"

Features

TODO

Contributing

  1. Fork the repository from https://github.com/danielcoderx/dtd.
  2. Create your feature branch: git checkout -b my-new-feature.
  3. Commit your changes: git commit -am 'Add some feature'.
  4. Push the branch to your forked repository: git push origin my-new-feature.
  5. Create a new Pull Request.

Contributors

Your 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!