feelin 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/feelin.gemspec +22 -0
- data/lib/feelin/js/node_modules/.package-lock.json +67 -0
- data/lib/feelin/js/node_modules/@lezer/common/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/common/README.md +14 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.cjs +2181 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.d.cts +1137 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.d.ts +1137 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.js +2168 -0
- data/lib/feelin/js/node_modules/@lezer/common/package.json +32 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/README.md +14 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.cjs +915 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.cts +621 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.ts +623 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.js +904 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/package.json +31 -0
- data/lib/feelin/js/node_modules/@lezer/lr/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/lr/README.md +25 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/constants.d.ts +45 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/constants.js +5 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.cjs +1890 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.d.cts +303 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.d.ts +303 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.js +1883 -0
- data/lib/feelin/js/node_modules/@lezer/lr/package.json +32 -0
- data/lib/feelin/js/node_modules/feelin/LICENSE +21 -0
- data/lib/feelin/js/node_modules/feelin/README.md +65 -0
- data/lib/feelin/js/node_modules/feelin/dist/builtins.d.ts +355 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.cjs +2072 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.cjs.map +1 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.d.ts +3 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.esm.js +2063 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.esm.js.map +1 -0
- data/lib/feelin/js/node_modules/feelin/dist/interpreter.d.ts +26 -0
- data/lib/feelin/js/node_modules/feelin/dist/parser.d.ts +4 -0
- data/lib/feelin/js/node_modules/feelin/dist/temporal.d.ts +6 -0
- data/lib/feelin/js/node_modules/feelin/dist/types.d.ts +35 -0
- data/lib/feelin/js/node_modules/feelin/dist/utils.d.ts +12 -0
- data/lib/feelin/js/node_modules/feelin/package.json +63 -0
- data/lib/feelin/js/node_modules/lezer-feel/LICENSE +21 -0
- data/lib/feelin/js/node_modules/lezer-feel/README.md +94 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.cjs +1328 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.cjs.map +1 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.d.ts +32 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.js +1323 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.js.map +1 -0
- data/lib/feelin/js/node_modules/lezer-feel/package.json +61 -0
- data/lib/feelin/js/node_modules/luxon/LICENSE.md +7 -0
- data/lib/feelin/js/node_modules/luxon/README.md +55 -0
- data/lib/feelin/js/node_modules/luxon/build/amd/luxon.js +8623 -0
- data/lib/feelin/js/node_modules/luxon/build/amd/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js +8621 -0
- data/lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/es6/luxon.js +8011 -0
- data/lib/feelin/js/node_modules/luxon/build/es6/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.js +8626 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.min.js +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.min.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/node/luxon.js +7679 -0
- data/lib/feelin/js/node_modules/luxon/build/node/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/package.json +87 -0
- data/lib/feelin/js/node_modules/luxon/src/datetime.js +2566 -0
- data/lib/feelin/js/node_modules/luxon/src/duration.js +990 -0
- data/lib/feelin/js/node_modules/luxon/src/errors.js +61 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/conversions.js +206 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/diff.js +95 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/digits.js +90 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/english.js +233 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/formats.js +176 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/formatter.js +409 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/invalid.js +14 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/locale.js +554 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/regexParser.js +335 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/tokenParser.js +505 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/util.js +316 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/zoneUtil.js +34 -0
- data/lib/feelin/js/node_modules/luxon/src/info.js +205 -0
- data/lib/feelin/js/node_modules/luxon/src/interval.js +665 -0
- data/lib/feelin/js/node_modules/luxon/src/luxon.js +26 -0
- data/lib/feelin/js/node_modules/luxon/src/package.json +4 -0
- data/lib/feelin/js/node_modules/luxon/src/settings.js +180 -0
- data/lib/feelin/js/node_modules/luxon/src/zone.js +97 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/IANAZone.js +231 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/fixedOffsetZone.js +150 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/invalidZone.js +53 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/systemZone.js +61 -0
- data/lib/feelin/js/node_modules/min-dash/LICENSE +21 -0
- data/lib/feelin/js/node_modules/min-dash/README.md +38 -0
- data/lib/feelin/js/node_modules/min-dash/dist/array.d.ts +12 -0
- data/lib/feelin/js/node_modules/min-dash/dist/collection.d.ts +174 -0
- data/lib/feelin/js/node_modules/min-dash/dist/fn.d.ts +37 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.cjs +910 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.d.ts +5 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.esm.js +872 -0
- data/lib/feelin/js/node_modules/min-dash/dist/lang.d.ts +29 -0
- data/lib/feelin/js/node_modules/min-dash/dist/min-dash.js +916 -0
- data/lib/feelin/js/node_modules/min-dash/dist/min-dash.min.js +1 -0
- data/lib/feelin/js/node_modules/min-dash/dist/object.d.ts +112 -0
- data/lib/feelin/js/node_modules/min-dash/package.json +72 -0
- data/lib/feelin/js/package-lock.json +72 -0
- data/lib/feelin/js/package.json +5 -0
- data/lib/feelin/version.rb +3 -0
- data/lib/feelin.rb +63 -0
- data/spec/feelin/feelin_spec.rb +38 -0
- data/spec/spec_helper.rb +2 -0
- metadata +198 -0
@@ -0,0 +1,335 @@
|
|
1
|
+
import {
|
2
|
+
untruncateYear,
|
3
|
+
signedOffset,
|
4
|
+
parseInteger,
|
5
|
+
parseMillis,
|
6
|
+
isUndefined,
|
7
|
+
parseFloating,
|
8
|
+
} from "./util.js";
|
9
|
+
import * as English from "./english.js";
|
10
|
+
import FixedOffsetZone from "../zones/fixedOffsetZone.js";
|
11
|
+
import IANAZone from "../zones/IANAZone.js";
|
12
|
+
|
13
|
+
/*
|
14
|
+
* This file handles parsing for well-specified formats. Here's how it works:
|
15
|
+
* Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
|
16
|
+
* An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object
|
17
|
+
* parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.
|
18
|
+
* Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors.
|
19
|
+
* combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.
|
20
|
+
* Some extractions are super dumb and simpleParse and fromStrings help DRY them.
|
21
|
+
*/
|
22
|
+
|
23
|
+
const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
24
|
+
|
25
|
+
function combineRegexes(...regexes) {
|
26
|
+
const full = regexes.reduce((f, r) => f + r.source, "");
|
27
|
+
return RegExp(`^${full}$`);
|
28
|
+
}
|
29
|
+
|
30
|
+
function combineExtractors(...extractors) {
|
31
|
+
return (m) =>
|
32
|
+
extractors
|
33
|
+
.reduce(
|
34
|
+
([mergedVals, mergedZone, cursor], ex) => {
|
35
|
+
const [val, zone, next] = ex(m, cursor);
|
36
|
+
return [{ ...mergedVals, ...val }, zone || mergedZone, next];
|
37
|
+
},
|
38
|
+
[{}, null, 1]
|
39
|
+
)
|
40
|
+
.slice(0, 2);
|
41
|
+
}
|
42
|
+
|
43
|
+
function parse(s, ...patterns) {
|
44
|
+
if (s == null) {
|
45
|
+
return [null, null];
|
46
|
+
}
|
47
|
+
|
48
|
+
for (const [regex, extractor] of patterns) {
|
49
|
+
const m = regex.exec(s);
|
50
|
+
if (m) {
|
51
|
+
return extractor(m);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return [null, null];
|
55
|
+
}
|
56
|
+
|
57
|
+
function simpleParse(...keys) {
|
58
|
+
return (match, cursor) => {
|
59
|
+
const ret = {};
|
60
|
+
let i;
|
61
|
+
|
62
|
+
for (i = 0; i < keys.length; i++) {
|
63
|
+
ret[keys[i]] = parseInteger(match[cursor + i]);
|
64
|
+
}
|
65
|
+
return [ret, null, cursor + i];
|
66
|
+
};
|
67
|
+
}
|
68
|
+
|
69
|
+
// ISO and SQL parsing
|
70
|
+
const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
|
71
|
+
const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
|
72
|
+
const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
|
73
|
+
const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
|
74
|
+
const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
|
75
|
+
const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
|
76
|
+
const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
|
77
|
+
const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
|
78
|
+
const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
|
79
|
+
const extractISOOrdinalData = simpleParse("year", "ordinal");
|
80
|
+
const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one
|
81
|
+
const sqlTimeRegex = RegExp(
|
82
|
+
`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`
|
83
|
+
);
|
84
|
+
const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
|
85
|
+
|
86
|
+
function int(match, pos, fallback) {
|
87
|
+
const m = match[pos];
|
88
|
+
return isUndefined(m) ? fallback : parseInteger(m);
|
89
|
+
}
|
90
|
+
|
91
|
+
function extractISOYmd(match, cursor) {
|
92
|
+
const item = {
|
93
|
+
year: int(match, cursor),
|
94
|
+
month: int(match, cursor + 1, 1),
|
95
|
+
day: int(match, cursor + 2, 1),
|
96
|
+
};
|
97
|
+
|
98
|
+
return [item, null, cursor + 3];
|
99
|
+
}
|
100
|
+
|
101
|
+
function extractISOTime(match, cursor) {
|
102
|
+
const item = {
|
103
|
+
hours: int(match, cursor, 0),
|
104
|
+
minutes: int(match, cursor + 1, 0),
|
105
|
+
seconds: int(match, cursor + 2, 0),
|
106
|
+
milliseconds: parseMillis(match[cursor + 3]),
|
107
|
+
};
|
108
|
+
|
109
|
+
return [item, null, cursor + 4];
|
110
|
+
}
|
111
|
+
|
112
|
+
function extractISOOffset(match, cursor) {
|
113
|
+
const local = !match[cursor] && !match[cursor + 1],
|
114
|
+
fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),
|
115
|
+
zone = local ? null : FixedOffsetZone.instance(fullOffset);
|
116
|
+
return [{}, zone, cursor + 3];
|
117
|
+
}
|
118
|
+
|
119
|
+
function extractIANAZone(match, cursor) {
|
120
|
+
const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;
|
121
|
+
return [{}, zone, cursor + 1];
|
122
|
+
}
|
123
|
+
|
124
|
+
// ISO time parsing
|
125
|
+
|
126
|
+
const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
|
127
|
+
|
128
|
+
// ISO duration parsing
|
129
|
+
|
130
|
+
const isoDuration =
|
131
|
+
/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
|
132
|
+
|
133
|
+
function extractISODuration(match) {
|
134
|
+
const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =
|
135
|
+
match;
|
136
|
+
|
137
|
+
const hasNegativePrefix = s[0] === "-";
|
138
|
+
const negativeSeconds = secondStr && secondStr[0] === "-";
|
139
|
+
|
140
|
+
const maybeNegate = (num, force = false) =>
|
141
|
+
num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;
|
142
|
+
|
143
|
+
return [
|
144
|
+
{
|
145
|
+
years: maybeNegate(parseFloating(yearStr)),
|
146
|
+
months: maybeNegate(parseFloating(monthStr)),
|
147
|
+
weeks: maybeNegate(parseFloating(weekStr)),
|
148
|
+
days: maybeNegate(parseFloating(dayStr)),
|
149
|
+
hours: maybeNegate(parseFloating(hourStr)),
|
150
|
+
minutes: maybeNegate(parseFloating(minuteStr)),
|
151
|
+
seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"),
|
152
|
+
milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),
|
153
|
+
},
|
154
|
+
];
|
155
|
+
}
|
156
|
+
|
157
|
+
// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York
|
158
|
+
// and not just that we're in -240 *right now*. But since I don't think these are used that often
|
159
|
+
// I'm just going to ignore that
|
160
|
+
const obsOffsets = {
|
161
|
+
GMT: 0,
|
162
|
+
EDT: -4 * 60,
|
163
|
+
EST: -5 * 60,
|
164
|
+
CDT: -5 * 60,
|
165
|
+
CST: -6 * 60,
|
166
|
+
MDT: -6 * 60,
|
167
|
+
MST: -7 * 60,
|
168
|
+
PDT: -7 * 60,
|
169
|
+
PST: -8 * 60,
|
170
|
+
};
|
171
|
+
|
172
|
+
function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
|
173
|
+
const result = {
|
174
|
+
year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
|
175
|
+
month: English.monthsShort.indexOf(monthStr) + 1,
|
176
|
+
day: parseInteger(dayStr),
|
177
|
+
hour: parseInteger(hourStr),
|
178
|
+
minute: parseInteger(minuteStr),
|
179
|
+
};
|
180
|
+
|
181
|
+
if (secondStr) result.second = parseInteger(secondStr);
|
182
|
+
if (weekdayStr) {
|
183
|
+
result.weekday =
|
184
|
+
weekdayStr.length > 3
|
185
|
+
? English.weekdaysLong.indexOf(weekdayStr) + 1
|
186
|
+
: English.weekdaysShort.indexOf(weekdayStr) + 1;
|
187
|
+
}
|
188
|
+
|
189
|
+
return result;
|
190
|
+
}
|
191
|
+
|
192
|
+
// RFC 2822/5322
|
193
|
+
const rfc2822 =
|
194
|
+
/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
|
195
|
+
|
196
|
+
function extractRFC2822(match) {
|
197
|
+
const [
|
198
|
+
,
|
199
|
+
weekdayStr,
|
200
|
+
dayStr,
|
201
|
+
monthStr,
|
202
|
+
yearStr,
|
203
|
+
hourStr,
|
204
|
+
minuteStr,
|
205
|
+
secondStr,
|
206
|
+
obsOffset,
|
207
|
+
milOffset,
|
208
|
+
offHourStr,
|
209
|
+
offMinuteStr,
|
210
|
+
] = match,
|
211
|
+
result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
|
212
|
+
|
213
|
+
let offset;
|
214
|
+
if (obsOffset) {
|
215
|
+
offset = obsOffsets[obsOffset];
|
216
|
+
} else if (milOffset) {
|
217
|
+
offset = 0;
|
218
|
+
} else {
|
219
|
+
offset = signedOffset(offHourStr, offMinuteStr);
|
220
|
+
}
|
221
|
+
|
222
|
+
return [result, new FixedOffsetZone(offset)];
|
223
|
+
}
|
224
|
+
|
225
|
+
function preprocessRFC2822(s) {
|
226
|
+
// Remove comments and folding whitespace and replace multiple-spaces with a single space
|
227
|
+
return s
|
228
|
+
.replace(/\([^()]*\)|[\n\t]/g, " ")
|
229
|
+
.replace(/(\s\s+)/g, " ")
|
230
|
+
.trim();
|
231
|
+
}
|
232
|
+
|
233
|
+
// http date
|
234
|
+
|
235
|
+
const rfc1123 =
|
236
|
+
/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,
|
237
|
+
rfc850 =
|
238
|
+
/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,
|
239
|
+
ascii =
|
240
|
+
/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
|
241
|
+
|
242
|
+
function extractRFC1123Or850(match) {
|
243
|
+
const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,
|
244
|
+
result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
|
245
|
+
return [result, FixedOffsetZone.utcInstance];
|
246
|
+
}
|
247
|
+
|
248
|
+
function extractASCII(match) {
|
249
|
+
const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,
|
250
|
+
result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
|
251
|
+
return [result, FixedOffsetZone.utcInstance];
|
252
|
+
}
|
253
|
+
|
254
|
+
const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
|
255
|
+
const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
|
256
|
+
const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
|
257
|
+
const isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
|
258
|
+
|
259
|
+
const extractISOYmdTimeAndOffset = combineExtractors(
|
260
|
+
extractISOYmd,
|
261
|
+
extractISOTime,
|
262
|
+
extractISOOffset,
|
263
|
+
extractIANAZone
|
264
|
+
);
|
265
|
+
const extractISOWeekTimeAndOffset = combineExtractors(
|
266
|
+
extractISOWeekData,
|
267
|
+
extractISOTime,
|
268
|
+
extractISOOffset,
|
269
|
+
extractIANAZone
|
270
|
+
);
|
271
|
+
const extractISOOrdinalDateAndTime = combineExtractors(
|
272
|
+
extractISOOrdinalData,
|
273
|
+
extractISOTime,
|
274
|
+
extractISOOffset,
|
275
|
+
extractIANAZone
|
276
|
+
);
|
277
|
+
const extractISOTimeAndOffset = combineExtractors(
|
278
|
+
extractISOTime,
|
279
|
+
extractISOOffset,
|
280
|
+
extractIANAZone
|
281
|
+
);
|
282
|
+
|
283
|
+
/*
|
284
|
+
* @private
|
285
|
+
*/
|
286
|
+
|
287
|
+
export function parseISODate(s) {
|
288
|
+
return parse(
|
289
|
+
s,
|
290
|
+
[isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
|
291
|
+
[isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],
|
292
|
+
[isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],
|
293
|
+
[isoTimeCombinedRegex, extractISOTimeAndOffset]
|
294
|
+
);
|
295
|
+
}
|
296
|
+
|
297
|
+
export function parseRFC2822Date(s) {
|
298
|
+
return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);
|
299
|
+
}
|
300
|
+
|
301
|
+
export function parseHTTPDate(s) {
|
302
|
+
return parse(
|
303
|
+
s,
|
304
|
+
[rfc1123, extractRFC1123Or850],
|
305
|
+
[rfc850, extractRFC1123Or850],
|
306
|
+
[ascii, extractASCII]
|
307
|
+
);
|
308
|
+
}
|
309
|
+
|
310
|
+
export function parseISODuration(s) {
|
311
|
+
return parse(s, [isoDuration, extractISODuration]);
|
312
|
+
}
|
313
|
+
|
314
|
+
const extractISOTimeOnly = combineExtractors(extractISOTime);
|
315
|
+
|
316
|
+
export function parseISOTimeOnly(s) {
|
317
|
+
return parse(s, [isoTimeOnly, extractISOTimeOnly]);
|
318
|
+
}
|
319
|
+
|
320
|
+
const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
|
321
|
+
const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
|
322
|
+
|
323
|
+
const extractISOTimeOffsetAndIANAZone = combineExtractors(
|
324
|
+
extractISOTime,
|
325
|
+
extractISOOffset,
|
326
|
+
extractIANAZone
|
327
|
+
);
|
328
|
+
|
329
|
+
export function parseSQL(s) {
|
330
|
+
return parse(
|
331
|
+
s,
|
332
|
+
[sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
|
333
|
+
[sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]
|
334
|
+
);
|
335
|
+
}
|