diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd647d..394b3d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.6.0 +- Adds the `IsoDuration.toDuration()` conversion method + ## 0.5.0 - Convert a recurrence rule to human readbable text using `recurrence.toHumanReadableText()`. With a recurrence of `RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU`, `recurrence.toHumanReadableText()` results in diff --git a/README.md b/README.md index 61f2701..b6f2d64 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,7 @@ Please file feature requests and bugs at the [issue tracker][tracker]. [tracker]: https://github.com/Enough-Software/enough_icalendar/issues ## Related Projects +* Use [enough_icalendar_export](https://pub.dev/packages/enough_icalendar_export) to export calendar invites to the native calendar * Check out [enough_mail_icalendar](https://pub.dev/packages/enough_mail_icalendar) for handling calendar invites in emails ## Null-Safety diff --git a/lib/src/types.dart b/lib/src/types.dart index f0b65d1..4626359 100644 --- a/lib/src/types.dart +++ b/lib/src/types.dart @@ -1202,6 +1202,17 @@ class IsoDuration { return buffer.toString(); } + /// Converts this ISO duration to an approximate Dart duration. + /// + /// The `days` are converted by assuming 365 days per year and 30 days per month: `days: years * 365 + months * 30 + weeks * 7 + days` + Duration toDuration() { + return Duration( + days: years * 365 + months * 30 + weeks * 7 + days, + hours: hours, + minutes: minutes, + seconds: seconds); + } + /// Parses the given [textValue] into a duration. /// /// The formmat is defined as `P[n]Y[n]M[n]DT[n]H[n]M[n]S` diff --git a/pubspec.yaml b/pubspec.yaml index 5b949cd..b4c54ac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: enough_icalendar description: iCalendar library to parse, generate and respond to iCal / ics invites. Fully compliant with RFC 5545 (iCalendar) and RFC 5546 (iTIP). -version: 0.5.0 +version: 0.6.0 homepage: https://github.com/Enough-Software/enough_icalendar environment: