Skip to content

Commit 0f7757e

Browse files
committed
version is bumped to 0.0.8.
1 parent ccb76a8 commit 0f7757e

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"api",
1212
"human-readable"
1313
],
14-
"version": "0.0.7",
14+
"version": "0.0.8",
1515
"homepage": "https://github.com/eserozvataf/temporal-parse#readme",
1616
"author": "Eser Ozvataf <[email protected]>",
1717
"contributors": [

src/date-tokenizer.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Deno.test(function tokenizeDateTest() {
1616
});
1717
});
1818

19+
Deno.test(function falseValues() {
20+
const parsedDate = parseDate("not a date", "generic-europe-asia");
21+
22+
asserts.assertEquals(parsedDate, undefined);
23+
});
24+
1925
Deno.test(function dateComparision() {
2026
for (let i = 0; i < dateSamplesEA.length; i++) {
2127
const dateEA = dateSamplesEA[i];
@@ -24,11 +30,11 @@ Deno.test(function dateComparision() {
2430
const dateUS = dateSamplesUS[i];
2531
const dateUSParsed = parseDate(dateUS, "generic-american");
2632

27-
console.log(
28-
`dateEA: ${dateEA}, dateUS: ${dateUS}`,
29-
dateEAParsed,
30-
dateUSParsed,
31-
);
33+
// console.log(
34+
// `dateEA: ${dateEA}, dateUS: ${dateUS}`,
35+
// dateEAParsed,
36+
// dateUSParsed,
37+
// );
3238
asserts.assertEquals(
3339
toDate(dateEAParsed!),
3440
toDate(dateUSParsed!),

src/format-tokenizer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ const tokenizeFormat = function tokenizeFormat(input: string): FormatToken[] {
421421
// console.log(currentToken, tokens.at(-1));
422422
if (
423423
tokenType === FormatTokenType.literal &&
424-
tokens.at(-1)?.[0] === FormatTokenType.literal
424+
tokens.slice(-1)?.[0]?.[0] === FormatTokenType.literal
425425
) {
426426
tokens[tokens.length - 1][1] += currentToken[1];
427427

@@ -436,7 +436,7 @@ const tokenizeFormat = function tokenizeFormat(input: string): FormatToken[] {
436436
for (let i = 0; i < input.length; i++) {
437437
const char = input[i];
438438

439-
if (inQuote === undefined && currentToken[1].at(-1) !== char) {
439+
if (inQuote === undefined && currentToken[1].slice(-1) !== char) {
440440
if (currentToken[1].length > 0) {
441441
pushToken();
442442
}
@@ -485,9 +485,9 @@ const formatTokenizerToRegExp = function formatTokenizerToRegExp(
485485
}
486486

487487
let nextChar = "$";
488-
const peek = arr.at(idx + 1);
488+
const peek = arr[idx + 1];
489489
if (peek !== undefined && peek[0] === FormatTokenType.literal) {
490-
nextChar = escapeRegExp(peek[1].at(0)!);
490+
nextChar = escapeRegExp(peek[1][0]!);
491491
}
492492

493493
const symbol = symbols[curr[1]];

0 commit comments

Comments
 (0)