aboutsummaryrefslogtreecommitdiffstats
path: root/npm_assets/node_modules/luxon/src/info.js
diff options
context:
space:
mode:
Diffstat (limited to 'npm_assets/node_modules/luxon/src/info.js')
-rw-r--r--npm_assets/node_modules/luxon/src/info.js58
1 files changed, 17 insertions, 41 deletions
diff --git a/npm_assets/node_modules/luxon/src/info.js b/npm_assets/node_modules/luxon/src/info.js
index 5197da2..d8c8e08 100644
--- a/npm_assets/node_modules/luxon/src/info.js
+++ b/npm_assets/node_modules/luxon/src/info.js
@@ -4,7 +4,7 @@ import Locale from "./impl/locale.js";
import IANAZone from "./zones/IANAZone.js";
import { normalizeZone } from "./impl/zoneUtil.js";
-import { hasFormatToParts, hasIntl, hasRelative } from "./impl/util.js";
+import { hasRelative } from "./impl/util.js";
/**
* The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.
@@ -16,11 +16,9 @@ export default class Info {
* @return {boolean}
*/
static hasDST(zone = Settings.defaultZone) {
- const proto = DateTime.now()
- .setZone(zone)
- .set({ month: 12 });
+ const proto = DateTime.now().setZone(zone).set({ month: 12 });
- return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset;
+ return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;
}
/**
@@ -29,7 +27,7 @@ export default class Info {
* @return {boolean}
*/
static isValidIANAZone(zone) {
- return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);
+ return IANAZone.isValidZone(zone);
}
/**
@@ -39,7 +37,7 @@ export default class Info {
* * If `input` is a string containing a valid time zone name, a Zone instance
* with that name is returned.
* * If `input` is a string that doesn't refer to a known time zone, a Zone
- * instance with {@link Zone.isValid} == false is returned.
+ * instance with {@link Zone#isValid} == false is returned.
* * If `input is a number, a Zone instance with the specified fixed offset
* in minutes is returned.
* * If `input` is `null` or `undefined`, the default zone is returned.
@@ -65,7 +63,7 @@ export default class Info {
* @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'
* @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'
* @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
- * @return {[string]}
+ * @return {Array}
*/
static months(
length = "long",
@@ -78,14 +76,14 @@ export default class Info {
* Return an array of format month names.
* Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that
* changes the string.
- * See {@link months}
+ * See {@link Info#months}
* @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
- * @return {[string]}
+ * @return {Array}
*/
static monthsFormat(
length = "long",
@@ -106,7 +104,7 @@ export default class Info {
* @example Info.weekdays('short')[0] //=> 'Mon'
* @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
- * @return {[string]}
+ * @return {Array}
*/
static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
@@ -116,13 +114,13 @@ export default class Info {
* Return an array of format week names.
* Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that
* changes the string.
- * See {@link weekdays}
- * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long".
+ * See {@link Info#weekdays}
+ * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long".
* @param {Object} opts - options
* @param {string} [opts.locale=null] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
- * @return {[string]}
+ * @return {Array}
*/
static weekdaysFormat(
length = "long",
@@ -137,7 +135,7 @@ export default class Info {
* @param {string} [opts.locale] - the locale code
* @example Info.meridiems() //=> [ 'AM', 'PM' ]
* @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
- * @return {[string]}
+ * @return {Array}
*/
static meridiems({ locale = null } = {}) {
return Locale.create(locale).meridiems();
@@ -151,7 +149,7 @@ export default class Info {
* @example Info.eras() //=> [ 'BC', 'AD' ]
* @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
* @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
- * @return {[string]}
+ * @return {Array}
*/
static eras(length = "short", { locale = null } = {}) {
return Locale.create(locale, null, "gregory").eras(length);
@@ -159,35 +157,13 @@ export default class Info {
/**
* Return the set of available features in this environment.
- * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case.
+ * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
* Keys:
- * * `zones`: whether this environment supports IANA timezones
- * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing
- * * `intl`: whether this environment supports general internationalization
* * `relative`: whether this environment supports relative time formatting
- * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false }
+ * @example Info.features() //=> { relative: false }
* @return {Object}
*/
static features() {
- let intl = false,
- intlTokens = false,
- zones = false,
- relative = false;
-
- if (hasIntl()) {
- intl = true;
- intlTokens = hasFormatToParts();
- relative = hasRelative();
-
- try {
- zones =
- new Intl.DateTimeFormat("en", { timeZone: "America/New_York" }).resolvedOptions()
- .timeZone === "America/New_York";
- } catch (e) {
- zones = false;
- }
- }
-
- return { intl, intlTokens, zones, relative };
+ return { relative: hasRelative() };
}
}