aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/date/index.ts19
-rw-r--r--src/modules/location/index.ts7
2 files changed, 25 insertions, 1 deletions
diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts
index 10196d6e..f2eac1cf 100644
--- a/src/modules/date/index.ts
+++ b/src/modules/date/index.ts
@@ -685,4 +685,23 @@ export class DateModule extends SimpleDateModule {
assertLocaleData(values, 'date.weekday', type);
return this.faker.helpers.arrayElement(values);
}
+
+ /**
+ * Returns a random IANA time zone name.
+ *
+ * The returned time zone is not tied to the current locale.
+ *
+ * @see [IANA Time Zone Database](https://www.iana.org/time-zones)
+ * @see faker.location.timeZone(): For generating a timezone based on the current locale.
+ *
+ * @example
+ * faker.location.timeZone() // 'Pacific/Guam'
+ *
+ * @since 9.0.0
+ */
+ timeZone(): string {
+ return this.faker.helpers.arrayElement(
+ this.faker.definitions.date.time_zone
+ );
+ }
}
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts
index 8fbbbe30..d55e0c8a 100644
--- a/src/modules/location/index.ts
+++ b/src/modules/location/index.ts
@@ -596,7 +596,12 @@ export class LocationModule extends ModuleBase {
}
/**
- * Returns a random time zone.
+ * Returns a random IANA time zone relevant to this locale.
+ *
+ * The returned time zone is tied to the current locale.
+ *
+ * @see [IANA Time Zone Database](https://www.iana.org/time-zones)
+ * @see faker.date.timeZone(): For generating a random time zone from all available time zones.
*
* @example
* faker.location.timeZone() // 'Pacific/Guam'