From 00fa4d8d9616c0e0588741fededf05714065c276 Mon Sep 17 00:00:00 2001 From: Oliver Jakoubek Date: Thu, 12 Feb 2026 11:54:19 +0100 Subject: [PATCH] Updated code examples in README --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 24265b6..feab745 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,15 @@ prevMonday := quando.Now().Prev(time.Monday) start := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC) end := time.Date(2028, 3, 15, 0, 0, 0, 0, time.UTC) duration := quando.Diff(start, end) -fmt.Println(duration.Human()) // "2 years, 2 months, 14 days" +fmt.Println(duration.Human()) // "2 years, 2 months" // Parsing (automatic format detection) date, err := quando.Parse("2026-02-09") -date, err := quando.Parse("09.02.2026") // EU format -date, err := quando.Parse("3 days ago") // Relative +date, err := quando.Parse("09.02.2026") // EU format + +// Relative dates +date, err := quando.ParseRelative("+3 days") // 3 days from now +date, err = quando.ParseRelative("-1 week") // 1 week ago // Formatting date.Format(quando.ISO) // "2026-02-09" @@ -176,7 +179,7 @@ duration := end.Sub(start) // quando: Built-in human formatting duration := quando.Diff(start, end) -fmt.Println(duration.Human()) // "2 years, 2 months, 14 days" ✅ +fmt.Println(duration.Human()) // "2 years, 2 months" ✅ ``` #### Start of Week (Monday)