diff --git a/.gitignore b/.gitignore index c500ca4..844ca7f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .packages test/.test_coverage.dart coverage/ +coverage_badge.svg pubspec.lock # Conventional directory for build outputs diff --git a/CHANGELOG.md b/CHANGELOG.md index f4516e1..2460d4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.1 + +- Fix breaking change from v1.1.0 by introducing @deprecated flag + ## 1.1.0 - Breaking Change: renamed `later` to `fromNow` to align with other ecosystems diff --git a/README.md b/README.md index ea578b3..353e318 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ final DateTime fourHoursFromNow = DateTime.now() + Duration(hours: 4); ## 🎖 Installation ```yaml dependencies: - time: "^1.1.0" + time: "^1.1.1" ``` ### ⚡ Import diff --git a/lib/src/extensions.dart b/lib/src/extensions.dart index e3b9136..0332cf9 100644 --- a/lib/src/extensions.dart +++ b/lib/src/extensions.dart @@ -42,6 +42,9 @@ extension DurationTimeExtension on Duration { /// Adds the Duration to the current DateTime and returns a DateTime in the future DateTime get fromNow => DateTime.now() + this; + @Deprecated('Use fromNow instead. Will be removed in 2.0.0') + DateTime get later => fromNow; + /// Subtracts the Duration from the current DateTime and returns a DateTime in the past DateTime get ago => DateTime.now() - this; } diff --git a/pubspec.yaml b/pubspec.yaml index a8c5562..3e43804 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: time description: Type-safe DateTime and Duration calculations, powered by extensions. -version: 1.1.0 +version: 1.1.1 homepage: https://github.com/jogboms/time.dart author: Jogboms diff --git a/test/time_test.dart b/test/time_test.dart index d8acc02..4a3da9d 100644 --- a/test/time_test.dart +++ b/test/time_test.dart @@ -104,6 +104,10 @@ void main() { expect(7.days.fromNow, _isAbout(DateTime.now() + 7.days)); }); + test('can still use later until 2.0.0', () { + expect(7.days.later, _isAbout(DateTime.now() + 7.days)); + }); + test('can be converted into a previous DateTime', () { expect(7.days.ago, _isAbout(DateTime.now() - 7.days)); });