Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: tried to encode an invalid date #658

Open
mkitzmann opened this issue Jan 7, 2022 · 3 comments
Open

Error: tried to encode an invalid date #658

mkitzmann opened this issue Jan 7, 2022 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mkitzmann
Copy link
Contributor

Updating quotes for EOD -> MSFT, TSLA, AAPL, A, AA, SUSW to update
/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse-server/lib/ParseServer.js:261
          throw err;
          ^

Error: Tried to encode an invalid date.
    at encode (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/encode.js:85:13)
    at _default (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/encode.js:132:10)
    at SetOp.toJSON (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/ParseOp.js:155:32)
    at AssetPrice._getSaveJSON (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/ParseObject.js:487:61)
    at AssetPrice._getSaveParams (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/ParseObject.js:503:23)
    at task (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/ParseObject.js:3187:35)
    at TaskQueue.enqueue (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/TaskQueue.js:34:7)
    at Object.enqueueTask (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/UniqueInstanceStateController.js:275:22)
    at Object.save (/Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/ParseObject.js:3202:30)
    at /Users/mkitzmann/Developer/GoPlan-app/node_modules/parse/lib/node/ParseObject.js:1816:25
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Process finished with exit code 7

@mkitzmann mkitzmann added the bug Something isn't working label Jan 7, 2022
@mkitzmann mkitzmann added this to the v0.1 MVP milestone Jan 7, 2022
@sadortun
Copy link
Member

@mkitzmann

This is most likely fixed by e7de1c4

We could add some checks to ensure that EOD result.timestamp is valid. or set a default value to now

-             assetPrice.recordedAt = dayjs.unix(result.timestamp).toDate();
+             assetPrice.recordedAt = result.timestamp ? dayjs.unix(result.timestamp).toDate() : dayjs().toDate();

@mkitzmann
Copy link
Contributor Author

@mkitzmann

This is most likely fixed by e7de1c4

We could add some checks to ensure that EOD result.timestamp is valid. or set a default value to now

The check would be good. Setting it to today might not be the right solution. Maybe we should improve the error message first, so we know what value this problem actually occurs on.

@sadortun
Copy link
Member

@mkitzmann how often do you have the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants