aboutsummaryrefslogtreecommitdiff
path: root/is/time.go
blob: 3aadaf1c7007edde2480c4a1006e09cbc174dce8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
	}
}