From 07569767f60e68d407bba9d19c7f9ddda6b6f45f Mon Sep 17 00:00:00 2001 From: Mattia Date: Thu, 21 Dec 2023 14:11:01 +0100 Subject: [PATCH] Fix issue when parsing dates formatted as "Streamed ago". Closes #265 . --- CHANGELOG.md | 3 +++ lib/src/extensions/helpers_extension.dart | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f13e165..4c1dacb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.4 +- Fix issue when parsing dates formatted as "Streamed ago" due to a leading whitespace. #265 + ## 2.0.3 - Better performance for iterating through closed captions elements. #251 - Add publishDate and viewCount for playlists. #240 diff --git a/lib/src/extensions/helpers_extension.dart b/lib/src/extensions/helpers_extension.dart index 905f5de..7986f5d 100644 --- a/lib/src/extensions/helpers_extension.dart +++ b/lib/src/extensions/helpers_extension.dart @@ -167,7 +167,7 @@ extension StringUtility2 on String? { return null; } - var parts = this!.split(' '); + var parts = this!.trim().split(' '); if (parts.length == 4) { // Streamed x y ago parts = parts.skip(1).toList();