abstract_date 1.0.2 copy "abstract_date: ^1.0.2" to clipboard
abstract_date: ^1.0.2 copied to clipboard

Abstract date is a fluent abstract date system for working with different date types.

example/example.dart

import 'package:abstract_date/abstract_date.dart';

void main() {
  ///
  ///default adapters are added automatically if you don't use [Date.addType]
  ///
  // Date.addType<ShamsiDate>(ShamsiDate());
  // Date.addType<GregorianDate>(GregorianDate());

  var date = Date<ShamsiDate>(1379, 6, 26);
  print(date.toString());

  var miladi = date.to<GregorianDate>();
  print(miladi);

  var hijri = date.to<HijriDate>();
  print(hijri);

  date = miladi.to<ShamsiDate>();
  print(date);

  var nth = Week.normalizeWeekDay(
      Date.getAdapterOfType<ShamsiDate>().firstDayOfTheWeek, DateTime.monday);

  print('Monday is the ${nth}rd day in shamsi calednar');

  if (date.isTypeOf<ShamsiDate>()) {
    print('its shamsi!');
  }

  var formatted = date.formatBuilder((f) {
    return '${f.yyyy} ${f.MMMM} ${f.dd}, ${f.DDDD}';
  });

  print(formatted);
}
1
likes
130
points
37
downloads

Publisher

verified publisheraligator.ir

Weekly Downloads

Abstract date is a fluent abstract date system for working with different date types.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

shamsi_date

More

Packages that depend on abstract_date