Skip to content

Commit

Permalink
fix: don't double-convert dates!
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredReisinger committed Sep 14, 2024
1 parent 6c86abe commit ac7614b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/commands/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,15 +813,15 @@ Examples:
let innerNum = 0;
let tryConvert = false;

helpers.dbg(2, 'converting date?', { innerValue });
helpers.dbg(0, 'converting date?', { innerValue });

// Typescript can't track type through an intermediate variable, so we just
// call typeof several times.
if (typeof innerValue === 'number') {
innerNum = innerValue;
tryConvert = true;
} else if (typeof innerValue === 'string') {
if (innerValue.match(/-?[0-9]{1,13}/)) {
if (innerValue.match(/^-?[0-9]{1,13}$/)) {
innerNum = Number.parseInt(innerValue, 10);
tryConvert = true;
}
Expand All @@ -835,7 +835,7 @@ Examples:
const date = moment.unix(innerNum);
const dateFmt = this.formatDate(date);

helpers.dbg(2, 'converting date', {
helpers.dbg(0, 'converting date', {
label: field.label,
innerValue,
date,
Expand All @@ -845,7 +845,7 @@ Examples:
return dateFmt;
}

helpers.dbg(2, "doesn't look like date", {
helpers.dbg(0, "doesn't look like date", {
label: field.label,
innerValue,
});
Expand Down

0 comments on commit ac7614b

Please sign in to comment.