1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00

test(processor): increase test coverage for parseISO8601Duration

This commit is contained in:
Frédéric Guillot 2025-07-07 16:56:00 -07:00
parent b48e6472f5
commit 2cfeefc8d2
5 changed files with 88 additions and 35 deletions

View file

@ -14,9 +14,9 @@ import (
"github.com/tdewolff/minify/v2/html"
)
// parseISO8601 parses a restricted subset of ISO8601 dates, mainly for youtube video durations
func parseISO8601(from string) (time.Duration, error) {
after, ok := strings.CutPrefix(from, "PT")
// parseISO8601Duration parses a subset of ISO8601 durations, mainly for youtube video.
func parseISO8601Duration(duration string) (time.Duration, error) {
after, ok := strings.CutPrefix(duration, "PT")
if !ok {
return 0, errors.New("the period doesn't start with PT")
}