AndrewPiterov / date_time

MIT License
3 stars 5 forks source link

Excellent Package #12

Open lhengl opened 2 years ago

lhengl commented 2 years ago

Hi,

I just want to say that this is an excellent package working with date separately to time. I was looking to build my own wrapper package for the DateTime class to achieve something similar. Luckily I found your package.

The key feature that stood out to me is the ability to use a const constructor as a default value. DateTime used to have this, but no longer. This makes it hard to work with the freezed package when all you want is a default value instead of using a required field.

Some other features I'd like added:

  1. The ability to show the difference in duration between 2 date values or 2 time values (currently can only be done with 1 date value and duration)
  2. The ability to pass a format to Date, DateRange, and TimeRange classes (currently only time is formattable)
  3. Introduce another class for DateAndTime to wrap DateTime so that it can be used as default values. This will just be a direct port from the DateTime class.
  4. More comparison for date ranges, such as:
    1. DateRange isWithin another dateRange
    2. DateRange encapsulates another dateRange (this.start < other.start && this.end > than other.end)
    3. DateRange is equal to, after, before, or overlap another date range
  5. Convenient default values such as:
    1. Date.startOfTime() - 0001-01-01
    2. Date.epoch() - 1970-01-01
    3. Date.endOfTime() - 9999-12-31

I'd be happy to contribute to this repos, if you'd let me.

Cheers!

AndrewPiterov commented 2 years ago

Hi @lhengl , glad to hear that someone else is using this package. Sure, feel free to contribute to this package and other mine packages. And please provide the desired implementation covered with tests. 🙌