simple_date_formatter 1.0.1 simple_date_formatter: ^1.0.1 copied to clipboard
A simple way to format dates
Simple Date Formatter #
A very simple package to format DateTime
objects in simple terms like Today, Next Week Wednesday etc.
Usage #
Import simple_date_formatter.dart
import "package:simple_date_formatter/simple_date_formatter.dart";
Use the fromNow
getter on any DateTime
object.
DateTime someDate = DateTime.now().add(Duration(days: 20));
print(someDate.fromNow); // Next Week Friday.
// This getter formats the date up to six week before and after now, beyond which it will return normal date formatting.
Additional Features #
This package also exposes two extra getters and one method. monthName
getter weekdayName
getter and addTime
method.
DateTime someDate = DateTime.now().add(Duration(days: 20));
print(someDate.monthName); // December
print(someDate.weekdayName): // Friday
someDate.addTime(TimeOfDay(hour: 10: minute: 30)); // adds time to `DateTime` object and returns it.