Skip to content

Commit

Permalink
chore: 3.1.0 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
renancaraujo authored May 1, 2024
1 parent 8c2bd9e commit 07283ee
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [3.1.0]
- docs: Update README.md
- feat: remove intl as dependency, fix UTC

## [3.0.0]
- feat!: update SDK constraints to dart 3
- chore: update dependencies
Expand Down
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dart pub add daylight
## Usage 📖


Check the API [docs](https://pub.dev/documentation/daylight/latest/), [example](https://github.com/renancaraujo/daylight/blob/master/example/example.dart) and [tests](https://github.com/renancaraujo/daylight/blob/master/test/daylight_test.dart) for more information about how to use it.
Check the API [docs](https://pub.dev/documentation/daylight/latest/), [example](https://github.com/renancaraujo/daylight/blob/master/example/example.dart) and [tests](https://github.com/renancaraujo/daylight/blob/master/test/src/daylight_test.dart) for more information about how to use it.

```dart
import 'package:daylight/daylight.dart';
Expand All @@ -43,26 +43,6 @@ print(DateTime.fromMillisecondsSinceEpoch(eventHourEpoch.floor()));
```


## Running Tests 🧪

To run all unit tests:

```sh
dart pub global activate coverage 1.2.0
dart test --coverage=coverage
dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info
```

To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov).

```sh
# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
open coverage/index.html
```

[dart_install_link]: https://dart.dev/get-dart
[github_actions_link]: https://docs.github.com/en/actions/learn-github-actions
[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
Expand Down
30 changes: 11 additions & 19 deletions lib/src/season.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,17 @@ enum Season {
extension SeasonDate on DateTime {
/// Retrieves the season for the current datetime instance
Season get seasonNorth {
switch (month) {
case DateTime.january || DateTime.february:
return Season.winter;
case DateTime.march:
return day < 21 ? Season.winter : Season.spring;
case DateTime.april || DateTime.may:
return Season.spring;
case DateTime.june:
return day < 21 ? Season.spring : Season.summer;
case DateTime.july || DateTime.august:
return Season.summer;
case DateTime.september:
return day < 22 ? Season.summer : Season.autumn;
case DateTime.october || DateTime.november:
return Season.autumn;
case DateTime.december:
return day < 22 ? Season.autumn : Season.winter;
}
throw Exception('Invalid date');
return switch (month) {
DateTime.january || DateTime.february => Season.winter,
DateTime.march => day < 21 ? Season.winter : Season.spring,
DateTime.april || DateTime.may => Season.spring,
DateTime.june => day < 21 ? Season.spring : Season.summer,
DateTime.july || DateTime.august => Season.summer,
DateTime.september => day < 22 ? Season.summer : Season.autumn,
DateTime.october || DateTime.november => Season.autumn,
DateTime.december => day < 22 ? Season.autumn : Season.winter,
_ => throw Exception('Invalid month $month'),
};
}

/// Retrieves the season for the current datetime instance
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: daylight
description: Get the sunset and sunrise times for a geolocation without having to access any remote api.
version: 3.0.0
version: 3.1.0
repository: https://github.com/renancaraujo/daylight
homepage: https://github.com/renancaraujo/daylight
issue_tracker: https://github.com/renancaraujo/daylight/issues
Expand Down

0 comments on commit 07283ee

Please sign in to comment.