Skip to content

Commit 7dbe685

Browse files
committed
Update timeZone tag name to timezone
1 parent 44f3347 commit 7dbe685

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

baked_in.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ var (
174174
"lowercase": isLowercase,
175175
"uppercase": isUppercase,
176176
"datetime": isDatetime,
177-
"timeZone": isTimeZone,
177+
"timezone": isTimeZone,
178178
}
179179
)
180180

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ This validates that a string value is a valid time zone based on the time zone d
10941094
Although empty value and Local value are allowed by time.LoadLocation golang function, they are not allowed by this validator.
10951095
More information on https://golang.org/pkg/time/#LoadLocation
10961096
1097-
Usage: timeZone
1097+
Usage: timezone
10981098
10991099
Alias Validators and Tags
11001100

validator_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9204,16 +9204,16 @@ func TestDatetimeValidation(t *testing.T) {
92049204

92059205
func TestTimeZoneValidation(t *testing.T) {
92069206
tests := []struct {
9207-
value string `validate:"timeZone"`
9207+
value string `validate:"timezone"`
92089208
tag string
92099209
expected bool
92109210
}{
92119211
// systems may have different time zone database, some systems time zone are case insensitive
9212-
{"America/New_York", `timeZone`, true},
9213-
{"UTC", `timeZone`, true},
9214-
{"", `timeZone`, false},
9215-
{"Local", `timeZone`, false},
9216-
{"Unknown", `timeZone`, false},
9212+
{"America/New_York", `timezone`, true},
9213+
{"UTC", `timezone`, true},
9214+
{"", `timezone`, false},
9215+
{"Local", `timezone`, false},
9216+
{"Unknown", `timezone`, false},
92179217
}
92189218

92199219
validate := New()
@@ -9231,14 +9231,14 @@ func TestTimeZoneValidation(t *testing.T) {
92319231
t.Fatalf("Index: %d time zone failed Error: %s", i, errs)
92329232
} else {
92339233
val := getError(errs, "", "")
9234-
if val.Tag() != "timeZone" {
9234+
if val.Tag() != "timezone" {
92359235
t.Fatalf("Index: %d time zone failed Error: %s", i, errs)
92369236
}
92379237
}
92389238
}
92399239
}
92409240

92419241
PanicMatches(t, func() {
9242-
_ = validate.Var(2, "timeZone")
9242+
_ = validate.Var(2, "timezone")
92439243
}, "Bad field type int")
92449244
}

0 commit comments

Comments
 (0)