Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

Commit 634830c

Browse files
feat(rules): Added Timezone rule
1 parent ba6d614 commit 634830c

5 files changed

Lines changed: 657 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ The library can be loaded either as a standalone script, or through an [AMD](htt
227227
- [SymbolVal](docs/symbol-val.md)
228228
- [SymbolicLink](docs/symbolic-link.md)
229229
- [Time](docs/time.md)
230+
- [Timezone](docs/timezone.md)
230231
- [Tld](docs/tld.md)
231232
- [TrueVal](docs/true-val.md)
232233
- [TypeOf](docs/type-of.md)

docs/timezone.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Timezone
2+
3+
Validates if the given input is a timezone.
4+
5+
Valid values:
6+
7+
```js
8+
validator.timezone().validate('Europe/Paris');
9+
validator.timezone().validate('US/Central');
10+
validator.timezone().validate('America/Sao_Paulo');
11+
```
12+
13+
Invalid values:
14+
15+
```js
16+
validator.timezone().validate('invalid/timezone');
17+
validator.timezone().validate(null);
18+
validator.timezone().validate(undefined);
19+
```

src/rules/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export * from './symbol-type';
145145
export * from './symbol-val';
146146
export * from './symbolic-link';
147147
export * from './time';
148+
export * from './timezone';
148149
export * from './tld';
149150
export * from './true-val';
150151
export * from './type-of';

0 commit comments

Comments
 (0)