Skip to content

Commit

Permalink
[historical] changes requested
Browse files Browse the repository at this point in the history
  • Loading branch information
glaucoheitor committed Apr 30, 2022
1 parent f699960 commit 10ac8cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/historical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ export default function historical(
else if (typeof value === "string") {
const timestamp = new Date(value as string).getTime();

if (isNaN(timestamp) || timestamp <= 0)
if (isNaN(timestamp))
throw new Error(
"yahooFinance.historical() option '" +
fieldName +
"' invalid date provided."
"' invalid date provided: '" +
value +
"'"
);

queryOptions[fieldName] = Math.floor(timestamp / 1000);
Expand Down

0 comments on commit 10ac8cc

Please sign in to comment.