From 26023a903cc22130f96a50e6e09d205c412615da Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 26 Nov 2025 17:40:56 +0100 Subject: add package is --- is/time.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 is/time.go (limited to 'is/time.go') diff --git a/is/time.go b/is/time.go new file mode 100644 index 0000000..3aadaf1 --- /dev/null +++ b/is/time.go @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2025 Stefan Majewsky +// SPDX-License-Identifier: Apache-2.0 + +package is + +import "time" + +// After(b)(a) is the same as a .After(b). +func After(rhs time.Time) func(time.Time) bool { + return func(lhs time.Time) bool { + return lhs.After(rhs) + } +} + +// Before(b)(a) is the same as a.Before(b). +func Before(rhs time.Time) func(time.Time) bool { + return func(lhs time.Time) bool { + return lhs.Before(rhs) + } +} + +// NotAfter(b)(a) is the same as !a.After(b). +func NotAfter(rhs time.Time) func(time.Time) bool { + return func(lhs time.Time) bool { + return !lhs.After(rhs) + } +} + +// NotBefore(b)(a) is the same as !a.Before(b). +func NotBefore(rhs time.Time) func(time.Time) bool { + return func(lhs time.Time) bool { + return !lhs.Before(rhs) + } +} -- cgit v1.2.3