aboutsummaryrefslogtreecommitdiff
path: root/is/time.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2025-11-26 17:40:56 +0100
committerStefan Majewsky <majewsky@gmx.net>2025-11-26 17:54:09 +0100
commit26023a903cc22130f96a50e6e09d205c412615da (patch)
tree1d4bf882a78978d6edb1f3b1f60d1f1f04b4e085 /is/time.go
parent3f447c28466911e234d421eb7e3310e14c30dfa9 (diff)
downloadgo-gg-26023a903cc22130f96a50e6e09d205c412615da.tar.gz
add package is
Diffstat (limited to 'is/time.go')
-rw-r--r--is/time.go34
1 files changed, 34 insertions, 0 deletions
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 <majewsky@gmx.net>
+// 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)
+ }
+}