UNPKG

luxon

Version:
1,329 lines (1,328 loc) 470 kB
{ "type": "File", "start": 0, "end": 6781, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 160, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 6781, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 160, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 38, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 17, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 17 } }, "imported": { "type": "Identifier", "start": 9, "end": 17, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 17 }, "identifierName": "DateTime" }, "name": "DateTime" }, "local": { "type": "Identifier", "start": 9, "end": 17, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 17 }, "identifierName": "DateTime" }, "name": "DateTime" } } ], "source": { "type": "StringLiteral", "start": 25, "end": 37, "loc": { "start": { "line": 1, "column": 25 }, "end": { "line": 1, "column": 37 } }, "extra": { "rawValue": "./datetime", "raw": "'./datetime'" }, "value": "./datetime" } }, { "type": "ImportDeclaration", "start": 39, "end": 77, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 38 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 48, "end": 56, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 } }, "imported": { "type": "Identifier", "start": 48, "end": 56, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 }, "identifierName": "Settings" }, "name": "Settings" }, "local": { "type": "Identifier", "start": 48, "end": 56, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 17 }, "identifierName": "Settings" }, "name": "Settings" } } ], "source": { "type": "StringLiteral", "start": 64, "end": 76, "loc": { "start": { "line": 2, "column": 25 }, "end": { "line": 2, "column": 37 } }, "extra": { "rawValue": "./settings", "raw": "'./settings'" }, "value": "./settings" } }, { "type": "ImportDeclaration", "start": 78, "end": 117, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 39 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 87, "end": 93, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 15 } }, "imported": { "type": "Identifier", "start": 87, "end": 93, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 15 }, "identifierName": "Locale" }, "name": "Locale" }, "local": { "type": "Identifier", "start": 87, "end": 93, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 15 }, "identifierName": "Locale" }, "name": "Locale" } } ], "source": { "type": "StringLiteral", "start": 101, "end": 116, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 38 } }, "extra": { "rawValue": "./impl/locale", "raw": "'./impl/locale'" }, "value": "./impl/locale" } }, { "type": "ImportDeclaration", "start": 118, "end": 153, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 35 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 127, "end": 131, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 13 } }, "imported": { "type": "Identifier", "start": 127, "end": 131, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 13 }, "identifierName": "Util" }, "name": "Util" }, "local": { "type": "Identifier", "start": 127, "end": 131, "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 13 }, "identifierName": "Util" }, "name": "Util" } } ], "source": { "type": "StringLiteral", "start": 139, "end": 152, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 34 } }, "extra": { "rawValue": "./impl/util", "raw": "'./impl/util'" }, "value": "./impl/util" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * 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.\n ", "start": 155, "end": 459, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 8, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "start": 460, "end": 6780, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 159, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "ClassDeclaration", "start": 467, "end": 6780, "loc": { "start": { "line": 9, "column": 7 }, "end": { "line": 159, "column": 1 } }, "id": { "type": "Identifier", "start": 473, "end": 477, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 17 }, "identifierName": "Info" }, "name": "Info", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 478, "end": 6780, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 159, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 672, "end": 935, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 25, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 679, "end": 685, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 15 }, "identifierName": "hasDST" }, "name": "hasDST" }, "static": true, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 686, "end": 713, "loc": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 43 } }, "left": { "type": "Identifier", "start": 686, "end": 690, "loc": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 20 }, "identifierName": "zone" }, "name": "zone" }, "right": { "type": "MemberExpression", "start": 693, "end": 713, "loc": { "start": { "line": 15, "column": 23 }, "end": { "line": 15, "column": 43 } }, "object": { "type": "Identifier", "start": 693, "end": 701, "loc": { "start": { "line": 15, "column": 23 }, "end": { "line": 15, "column": 31 }, "identifierName": "Settings" }, "name": "Settings" }, "property": { "type": "Identifier", "start": 702, "end": 713, "loc": { "start": { "line": 15, "column": 32 }, "end": { "line": 15, "column": 43 }, "identifierName": "defaultZone" }, "name": "defaultZone" }, "computed": false } } ], "body": { "type": "BlockStatement", "start": 715, "end": 935, "loc": { "start": { "line": 15, "column": 45 }, "end": { "line": 25, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 721, "end": 931, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 24, "column": 6 } }, "argument": { "type": "LogicalExpression", "start": 736, "end": 924, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 23, "column": 35 } }, "left": { "type": "UnaryExpression", "start": 736, "end": 751, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 21 } }, "operator": "!", "prefix": true, "argument": { "type": "MemberExpression", "start": 737, "end": 751, "loc": { "start": { "line": 17, "column": 7 }, "end": { "line": 17, "column": 21 } }, "object": { "type": "Identifier", "start": 737, "end": 741, "loc": { "start": { "line": 17, "column": 7 }, "end": { "line": 17, "column": 11 }, "identifierName": "zone" }, "name": "zone" }, "property": { "type": "Identifier", "start": 742, "end": 751, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 21 }, "identifierName": "universal" }, "name": "universal" }, "computed": false }, "extra": { "parenthesizedArgument": false } }, "operator": "&&", "right": { "type": "BinaryExpression", "start": 761, "end": 924, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 23, "column": 35 } }, "left": { "type": "MemberExpression", "start": 761, "end": 834, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 20, "column": 33 } }, "object": { "type": "CallExpression", "start": 761, "end": 827, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 20, "column": 26 } }, "callee": { "type": "MemberExpression", "start": 761, "end": 813, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 20, "column": 12 } }, "object": { "type": "CallExpression", "start": 761, "end": 800, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 19, "column": 22 } }, "callee": { "type": "MemberExpression", "start": 761, "end": 794, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 19, "column": 16 } }, "object": { "type": "CallExpression", "start": 761, "end": 777, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 22 } }, "callee": { "type": "MemberExpression", "start": 761, "end": 775, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 20 } }, "object": { "type": "Identifier", "start": 761, "end": 769, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 14 }, "identifierName": "DateTime" }, "name": "DateTime" }, "property": { "type": "Identifier", "start": 770, "end": 775, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 20 }, "identifierName": "local" }, "name": "local" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 787, "end": 794, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 16 }, "identifierName": "setZone" }, "name": "setZone" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 795, "end": 799, "loc": { "start": { "line": 19, "column": 17 }, "end": { "line": 19, "column": 21 }, "identifierName": "zone" }, "name": "zone" } ] }, "property": { "type": "Identifier", "start": 810, "end": 813, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 12 }, "identifierName": "set" }, "name": "set" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 814, "end": 826, "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 25 } }, "properties": [ { "type": "ObjectProperty", "start": 816, "end": 824, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 23 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 816, "end": 821, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 20 }, "identifierName": "month" }, "name": "month" }, "value": { "type": "NumericLiteral", "start": 823, "end": 824, "loc": { "start": { "line": 20, "column": 22 }, "end": { "line": 20, "column": 23 } }, "extra": { "rawValue": 1, "raw": "1" }, "value": 1 } } ] } ] }, "property": { "type": "Identifier", "start": 828, "end": 834, "loc": { "start": { "line": 20, "column": 27 }, "end": { "line": 20, "column": 33 }, "identifierName": "offset" }, "name": "offset" }, "computed": false }, "operator": "!==", "right": { "type": "MemberExpression", "start": 847, "end": 924, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 23, "column": 35 } }, "object": { "type": "CallExpression", "start": 847, "end": 917, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 23, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 847, "end": 903, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 23, "column": 14 } }, "object": { "type": "CallExpression", "start": 847, "end": 888, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 22, "column": 24 } }, "callee": { "type": "MemberExpression", "start": 847, "end": 882, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 22, "column": 18 } }, "object": { "type": "CallExpression", "start": 847, "end": 863, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 24 } }, "callee": { "type": "MemberExpression", "start": 847, "end": 861, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 22 } }, "object": { "type": "Identifier", "start": 847, "end": 855, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 16 }, "identifierName": "DateTime" }, "name": "DateTime" }, "property": { "type": "Identifier", "start": 856, "end": 861, "loc": { "start": { "line": 21, "column": 17 }, "end": { "line": 21, "column": 22 }, "identifierName": "local" }, "name": "local" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 875, "end": 882, "loc": { "start": { "line": 22, "column": 11 }, "end": { "line": 22, "column": 18 }, "identifierName": "setZone" }, "name": "setZone" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 883, "end": 887, "loc": { "start": { "line": 22, "column": 19 }, "end": { "line": 22, "column": 23 }, "identifierName": "zone" }, "name": "zone" } ] }, "property": { "type": "Identifier", "start": 900, "end": 903, "loc": { "start": { "line": 23, "column": 11 }, "end": { "line": 23, "column": 14 }, "identifierName": "set" }, "name": "set" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 904, "end": 916, "loc": { "start": { "line": 23, "column": 15 }, "end": { "line": 23, "column": 27 } }, "properties": [ { "type": "ObjectProperty", "start": 906, "end": 914, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 25 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 906, "end": 911, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 22 }, "identifierName": "month" }, "name": "month" }, "value": { "type": "NumericLiteral", "start": 913, "end": 914, "loc": { "start": { "line": 23, "column": 24 }, "end": { "line": 23, "column": 25 } }, "extra": { "rawValue": 5, "raw": "5" }, "value": 5 } } ] } ] }, "property": { "type": "Identifier", "start": 918, "end": 924, "loc": { "start": { "line": 23, "column": 29 }, "end": { "line": 23, "column": 35 }, "identifierName": "offset" }, "name": "offset" }, "computed": false } }, "extra": { "parenthesized": true, "parenStart": 728 } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n ", "start": 482, "end": 669, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 14, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {object} opts - options\n * @param {string} [opts.locale='en'] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {[string]}\n ", "start": 939, "end": 1862, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 42, "column": 5 } }