luxon
Version:
Immutable date wrapper
1,630 lines • 125 kB
JSON
{
"type": "File",
"start": 0,
"end": 1503,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 68,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1503,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 68,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 46
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "LocalZone"
},
"name": "LocalZone"
},
"local": {
"type": "Identifier",
"start": 9,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "LocalZone"
},
"name": "LocalZone"
}
}
],
"source": {
"type": "StringLiteral",
"start": 26,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 45
}
},
"extra": {
"rawValue": "./zones/localZone",
"raw": "'./zones/localZone'"
},
"value": "./zones/localZone"
}
},
{
"type": "ImportDeclaration",
"start": 47,
"end": 82,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 35
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 56,
"end": 60,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
}
},
"imported": {
"type": "Identifier",
"start": 56,
"end": 60,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "Util"
},
"name": "Util"
},
"local": {
"type": "Identifier",
"start": 56,
"end": 60,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "Util"
},
"name": "Util"
}
}
],
"source": {
"type": "StringLiteral",
"start": 68,
"end": 81,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 34
}
},
"extra": {
"rawValue": "./impl/util",
"raw": "'./impl/util'"
},
"value": "./impl/util"
}
},
{
"type": "VariableDeclaration",
"start": 84,
"end": 183,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 25
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 88,
"end": 120,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 88,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 7
},
"identifierName": "now"
},
"name": "now"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 94,
"end": 120,
"loc": {
"start": {
"line": 4,
"column": 10
},
"end": {
"line": 4,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 88,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 7
},
"identifierName": "now"
},
"name": "now"
},
"generator": false,
"expression": true,
"async": false,
"params": [],
"body": {
"type": "CallExpression",
"start": 100,
"end": 120,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 36
}
},
"callee": {
"type": "MemberExpression",
"start": 100,
"end": 118,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 34
}
},
"object": {
"type": "NewExpression",
"start": 100,
"end": 110,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 26
}
},
"callee": {
"type": "Identifier",
"start": 104,
"end": 108,
"loc": {
"start": {
"line": 4,
"column": 20
},
"end": {
"line": 4,
"column": 24
},
"identifierName": "Date"
},
"name": "Date"
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 111,
"end": 118,
"loc": {
"start": {
"line": 4,
"column": 27
},
"end": {
"line": 4,
"column": 34
},
"identifierName": "valueOf"
},
"name": "valueOf"
},
"computed": false
},
"arguments": []
}
}
},
{
"type": "VariableDeclarator",
"start": 124,
"end": 156,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 34
}
},
"id": {
"type": "Identifier",
"start": 124,
"end": 135,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 5,
"column": 13
},
"identifierName": "defaultZone"
},
"name": "defaultZone"
},
"init": {
"type": "MemberExpression",
"start": 138,
"end": 156,
"loc": {
"start": {
"line": 5,
"column": 16
},
"end": {
"line": 5,
"column": 34
}
},
"object": {
"type": "Identifier",
"start": 138,
"end": 147,
"loc": {
"start": {
"line": 5,
"column": 16
},
"end": {
"line": 5,
"column": 25
},
"identifierName": "LocalZone"
},
"name": "LocalZone"
},
"property": {
"type": "Identifier",
"start": 148,
"end": 156,
"loc": {
"start": {
"line": 5,
"column": 26
},
"end": {
"line": 5,
"column": 34
},
"identifierName": "instance"
},
"name": "instance"
},
"computed": false
}
},
{
"type": "VariableDeclarator",
"start": 160,
"end": 182,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 24
}
},
"id": {
"type": "Identifier",
"start": 160,
"end": 174,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 16
},
"identifierName": "throwOnInvalid"
},
"name": "throwOnInvalid"
},
"init": {
"type": "BooleanLiteral",
"start": 177,
"end": 182,
"loc": {
"start": {
"line": 6,
"column": 19
},
"end": {
"line": 6,
"column": 24
}
},
"value": false
}
}
],
"kind": "let",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n ",
"start": 185,
"end": 360,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 10,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 361,
"end": 1502,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 67,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "ClassDeclaration",
"start": 368,
"end": 1502,
"loc": {
"start": {
"line": 11,
"column": 7
},
"end": {
"line": 67,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 374,
"end": 382,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 21
},
"identifierName": "Settings"
},
"name": "Settings",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 383,
"end": 1502,
"loc": {
"start": {
"line": 11,
"column": 22
},
"end": {
"line": 67,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 480,
"end": 518,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 18,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 491,
"end": 494,
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 16
},
"identifierName": "now"
},
"name": "now"
},
"static": true,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 497,
"end": 518,
"loc": {
"start": {
"line": 16,
"column": 19
},
"end": {
"line": 18,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 503,
"end": 514,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 15
}
},
"argument": {
"type": "Identifier",
"start": 510,
"end": 513,
"loc": {
"start": {
"line": 17,
"column": 11
},
"end": {
"line": 17,
"column": 14
},
"identifierName": "now"
},
"name": "now"
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get the callback for returning the current timestamp.\n * @type {function}\n ",
"start": 387,
"end": 477,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 15,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the callback for returning the current timestamp.\n * @type {function}\n ",
"start": 522,
"end": 612,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 23,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 615,
"end": 651,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 26,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 626,
"end": 629,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 16
},
"identifierName": "now"
},
"name": "now"
},
"static": true,
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 630,
"end": 631,
"loc": {
"start": {
"line": 24,
"column": 17
},
"end": {
"line": 24,
"column": 18
},
"identifierName": "n"
},
"name": "n"
}
],
"body": {
"type": "BlockStatement",
"start": 633,
"end": 651,
"loc": {
"start": {
"line": 24,
"column": 20
},
"end": {
"line": 26,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 639,
"end": 647,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 12
}
},
"expression": {
"type": "AssignmentExpression",
"start": 639,
"end": 646,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 11
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 639,
"end": 642,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 7
},
"identifierName": "now"
},
"name": "now"
},
"right": {
"type": "Identifier",
"start": 645,
"end": 646,
"loc": {
"start": {
"line": 25,
"column": 10
},
"end": {
"line": 25,
"column": 11
},
"identifierName": "n"
},
"name": "n"
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the callback for returning the current timestamp.\n * @type {function}\n ",
"start": 522,
"end": 612,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 23,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the default time zone to create DateTimes in.\n * @type {string}\n ",
"start": 655,
"end": 739,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 31,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 742,
"end": 805,
"loc": {
"start": {
"line": 32,
"column": 2
},
"end": {
"line": 34,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 753,
"end": 768,
"loc": {
"start": {
"line": 32,
"column": 13
},
"end": {
"line": 32,
"column": 28
},
"identifierName": "defaultZoneName"
},
"name": "defaultZoneName"
},
"static": true,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 771,
"end": 805,
"loc": {
"start": {
"line": 32,
"column": 31
},
"end": {
"line": 34,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 777,
"end": 801,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 33,
"column": 28
}
},
"argument": {
"type": "MemberExpression",
"start": 784,
"end": 800,
"loc": {
"start": {
"line": 33,
"column": 11
},
"end": {
"line": 33,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 784,
"end": 795,
"loc": {
"start": {
"line": 33,
"column": 11
},
"end": {
"line": 33,
"column": 22
},
"identifierName": "defaultZone"
},
"name": "defaultZone"
},
"property": {
"type": "Identifier",
"start": 796,
"end": 800,
"loc": {
"start": {
"line": 33,
"column": 23
},
"end": {
"line": 33,
"column": 27
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the default time zone to create DateTimes in.\n * @type {string}\n ",
"start": 655,
"end": 739,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 31,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the default time zone to create DateTimes in.\n * @type {string}\n ",
"start": 809,
"end": 893,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 39,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 896,
"end": 972,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 42,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 907,
"end": 922,
"loc": {
"start": {
"line": 40,
"column": 13
},
"end": {
"line": 40,
"column": 28
},
"identifierName": "defaultZoneName"
},
"name": "defaultZoneName"
},
"static": true,
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 923,
"end": 924,
"loc": {
"start": {
"line": 40,
"column": 29
},
"end": {
"line": 40,
"column": 30
},
"identifierName": "z"
},
"name": "z"
}
],
"body": {
"type": "BlockStatement",
"start": 926,
"end": 972,
"loc": {
"start": {
"line": 40,
"column": 32
},
"end": {
"line": 42,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 932,
"end": 968,
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 41,
"column": 40
}
},
"expression": {
"type": "AssignmentExpression",
"start": 932,
"end": 967,
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 41,
"column": 39
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 932,
"end": 943,
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 41,
"column": 15
},
"identifierName": "defaultZone"
},
"name": "defaultZone"
},
"right": {
"type": "CallExpression",
"start": 946,
"end": 967,
"loc": {
"start": {
"line": 41,
"column": 18
},
"end": {
"line": 41,
"column": 39
}
},
"callee": {
"type": "MemberExpression",
"start": 946,
"end": 964,
"loc": {
"start": {
"line": 41,
"column": 18
},
"end": {
"line": 41,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 946,
"end": 950,
"loc": {
"start": {
"line": 41,
"column": 18
},
"end": {
"line": 41,
"column": 22
},
"identifierName": "Util"
},
"name": "Util"
},
"property": {
"type": "Identifier",
"start": 951,
"end": 964,
"loc": {
"start": {
"line": 41,
"column": 23
},
"end": {
"line": 41,
"column": 36
},
"identifierName": "normalizeZone"
},
"name": "normalizeZone"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 965,
"end": 966,
"loc": {
"start": {
"line": 41,
"column": 37
},
"end": {
"line": 41,
"column": 38
},
"identifierName": "z"
},
"name": "z"
}
]
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the default time zone to create DateTimes in.\n * @type {string}\n ",
"start": 809,
"end": 893,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 39,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get the default time zone object to create DateTimes in.\n * @type {Zone}\n ",
"start": 976,
"end": 1065,
"loc": {
"start": {
"line": 44,
"column": 2
},
"end": {
"line": 47,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1068,
"end": 1122,
"loc": {
"start": {
"line": 48,
"column": 2
},
"end": {
"line": 50,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1079,
"end": 1090,
"loc": {
"start": {
"line": 48,
"column": 13
},
"end": {
"line": 48,
"column": 24
},
"identifierName": "defaultZone"
},
"name": "defaultZone"
},
"static": true,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1093,
"end": 1122,
"loc": {
"start": {
"line": 48,
"column": 27
},
"end": {
"line": 50,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1099,
"end": 1118,
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 49,
"column": 23
}
},
"argument": {
"type": "Identifier",
"start": 1106,
"end": 1117,
"loc": {
"start": {
"line": 49,
"column": 11
},
"end": {
"line": 49,
"column": 22
},
"identifierName": "defaultZone"
},
"name": "defaultZone"
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get the default time zone object to create DateTimes in.\n * @type {Zone}\n ",
"start": 976,
"end": 1065,
"loc": {
"start": {
"line": 44,
"column": 2
},
"end": {
"line": 47,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {Zone}\n ",
"start": 1126,
"end": 1249,
"loc": {
"start": {
"line": 52,
"column": 2
},
"end": {
"line": 55,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1252,
"end": 1312,
"loc": {
"start": {
"line": 56,
"column": 2
},
"end": {
"line": 58,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1263,
"end": 1277,
"loc": {
"start": {
"line": 56,
"column": 13
},
"end": {
"line": 56,
"column": 27
},
"identifierName": "throwOnInvalid"
},
"name": "throwOnInvalid"
},
"static": true,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1280,
"end": 1312,
"loc": {
"start": {
"line": 56,
"column": 30
},
"end": {
"line": 58,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1286,
"end": 1308,
"loc": {
"start": {
"line": 57,
"column": 4
},
"end": {
"line": 57,
"column": 26
}
},
"argument": {
"type": "Identifier",
"start": 1293,
"end": 1307,
"loc": {
"start": {
"line": 57,
"column": 11
},
"end": {
"line": 57,
"column": 25
},
"identifierName": "throwOnInvalid"
},
"name": "throwOnInvalid"
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {Zone}\n ",
"start": 1126,
"end": 1249,
"loc": {
"start": {
"line": 52,
"column": 2
},
"end": {
"line": 55,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {Zone}\n ",
"start": 1316,
"end": 1439,
"loc": {
"start": {
"line": 60,
"column": 2
},
"end": {
"line": 63,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1442,
"end": 1500,
"loc": {
"start": {
"line": 64,
"column": 2
},
"end": {
"line": 66,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1453,
"end": 1467,
"loc": {
"start": {
"line": 64,
"column": 13
},
"end": {
"line": 64,
"column": 27
},
"identifierName": "throwOnInvalid"
},
"name": "throwOnInvalid"
},
"static": true,
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1468,
"end": 1469,
"loc": {
"start": {
"line": 64,
"column": 28
},
"end": {
"line": 64,
"column": 29
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 1471,
"end": 1500,
"loc": {
"start": {
"line": 64,
"column": 31
},
"end": {
"line": 66,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1477,
"end": 1496,
"loc": {
"start": {
"line": 65,
"column": 4
},
"end": {
"line": 65,
"column": 23