date_time 0.0.1 copy "date_time: ^0.0.1" to clipboard
date_time: ^0.0.1 copied to clipboard

outdated

Package to work with Date & Time in separation and with its Ranges.

date_time #

Package to work with Date & Time in separation and with its ranges.

This project will be useful for projects that are related to booking.

Features #

  • Only Date comparison
  • Only Time comparison
  • Find crossing of dates
  • Find crossing of times in the day

Getting started #

  1. Add dependency
dependencies:
  date_time: <newest>
  1. Import the dependency
import 'package:date_time/date_time.dart';

Usage #

Please, check (examples.dart) folder for more advanced examples.

Date #

given('DateTime', () {
  final dateTime = DateTime(2020, 11, 30, 14, 33, 17);

  then('date should be equal to', () {
    dateTime.date.should.be(Date(2020, 11, 30));
  });

  then('time should be equal to', () {
    dateTime.time.should.be(Time(14, mins: 33, secs: 17));
  });
});

DateRange #

final range = DateRange(
  const Date(2021, 1, 1),
  const Date(2021, 12, 31),
);

test('should be valid', () {
  range.isValid.should.beTrue();
});

Time #

final time2 = time.addMinutes(30);
final isTime2After = time2 > time;
final isTime2After2 = time2.isAfter(time);
print('Is time2 after: $isTime2After');

TimeRange #

// TimeRange crossing
final timeRange = TimeRange(Time.now, Time.now.addHours(6));
final timeRange2 = TimeRange(Time.now.addHours(3), Time.now.addHours(9));

final isCrossing = timeRange.isCross(timeRange2);
print('Time ranges are crossing: $isCrossing');

Contributing #

We accept the following contributions:

  • New features
  • Improving documentation
  • Reporting issues
  • Fixing bugs

Maintainers #

18
likes
0
pub points
87%
popularity

Publisher

verified publisherdevcraft.ninja

Package to work with Date & Time in separation and with its Ranges.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

quiver

More

Packages that depend on date_time