diff --git a/CHANGELOG.md b/CHANGELOG.md index f75c82b..15a5dd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,28 @@ # πŸ—’ Release Notes -## v2.2.0 (2024-03-08) +## v2.2.1 (2024-03-28) -- Add the German πŸ‡©πŸ‡ͺ language support +- Updated `README.md` file by adding more information about supported languages - Formatted `CHANGELOG.md` file +- Added more tests +## v2.2.0 (2024-03-08) + +- Added the German πŸ‡©πŸ‡ͺ language support +- Formatted `CHANGELOG.md` file ## v2.1.11 (2023-12-26) -- Update Go version in `go.mod` to `1.13` -- Change package namespace to `github.com/SerhiiCho/timeago/v2` to match Go versioning rules +- Updated Go version in `go.mod` to `1.13` +- Changed package namespace to `github.com/SerhiiCho/timeago/v2` to match Go versioning rules ## v2.1.10 (2023-12-26) -- Update Go version in `go.mod` from `1.13` to `1.21.0` +- Updated Go version in `go.mod` from `1.13` to `1.21.0` ## v2.1.9 (2023-12-26) -- Update `CHANGELOG.md` file +- Updated `CHANGELOG.md` file ## v2.1.8 (2023-12-03) @@ -83,7 +88,7 @@ ## v2.0.3 (2022-01-22) -- Added support for Dutch language +- Added support for Dutch πŸ‡³πŸ‡± language ## v2.0.2 (2022-01-21) diff --git a/README.md b/README.md index bcaf756..6656643 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/SerhiiCho/timeago/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/SerhiiCho/timeago/?branch=main) [![GitHub](https://img.shields.io/github/license/SerhiiCho/timeago)](https://github.com/SerhiiCho/timeago/blob/main/LICENSE.md) -Fast and lightweight date time package that converts given date into "n time ago" format. The package has many cool features and several supported languages. +Timeago is a fast and lightweight date time package that converts given date into human readable "n time ago" format in different languages, such as πŸ‡·πŸ‡Ί πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡¦ πŸ‡©πŸ‡ͺ. For more information you can read the [documentation](https://serhiicho.github.io/timeago-docs/). ### Follow the [Official documentation](https://serhiicho.github.io/timeago-docs/) for all the details diff --git a/timeago_test.go b/timeago_test.go index b3f0343..7f09a49 100644 --- a/timeago_test.go +++ b/timeago_test.go @@ -28,9 +28,7 @@ func TestGetWords(t *testing.T) { for _, tc := range cases { t.Run(tc.result, func(test *testing.T) { - SetConfig(Config{ - Language: tc.lang, - }) + SetConfig(Config{Language: tc.lang}) if res := getWords(tc.timeKind, tc.num); res != tc.result { test.Errorf("Result must be `%s` but got `%s` instead", tc.result, res) @@ -48,13 +46,17 @@ func TestParseFunctionCanExceptTimestamp(t *testing.T) { {getTimestampOfPastDate(time.Minute * 5), "5 minutes ago"}, {getTimestampOfPastDate(time.Hour), "1 hour ago"}, {getTimestampOfPastDate(time.Hour * 3), "3 hours ago"}, + {getTimestampOfPastDate(time.Hour * 5), "5 hours ago"}, {getTimestampOfPastDate(time.Hour * 24), "1 day ago"}, - {getTimestampOfPastDate(time.Hour * 48), "2 days ago"}, + {getTimestampOfPastDate(time.Hour * 24 * 2), "2 days ago"}, + {getTimestampOfPastDate(time.Hour * 24 * 3), "3 days ago"}, + {getTimestampOfPastDate(time.Hour * 24 * 4), "4 days ago"}, + {getTimestampOfPastDate(time.Hour * 24 * 5), "5 days ago"}, + {getTimestampOfPastDate(time.Hour * 24 * 6), "6 days ago"}, + {getTimestampOfPastDate(time.Hour * 24 * 7), "1 week ago"}, } - SetConfig(Config{ - Language: "en", - }) + SetConfig(Config{Language: "en"}) for _, tc := range cases { t.Run(tc.result, func(test *testing.T) { @@ -83,9 +85,7 @@ func TestParseFunctionCanExceptTimePackage(t *testing.T) { {time.Now().Add(-time.Hour * 11), "11 hours ago"}, } - SetConfig(Config{ - Language: "en", - }) + SetConfig(Config{Language: "en"}) for _, tc := range cases { t.Run("Test for date "+tc.time.String(), func(test *testing.T) { @@ -109,9 +109,7 @@ func TestParseFuncWillCalculateIntervalToFutureDate(t *testing.T) { {time.Now().Add(time.Hour * 48), "2 days"}, } - SetConfig(Config{ - Language: "en", - }) + SetConfig(Config{Language: "en"}) for _, tc := range testCases { t.Run("Test for date: "+tc.time.String(), func(test *testing.T) {