question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: this._options.handleDate is not a function

See original GitHub issue

Exporting an object with a Date throws an error TypeError: this._options.handleDate is not a function when it should be exported as a local date format as the default handleDate function is implemented:

https://github.com/kaue/jsonexport/blob/f486a71432d6ea6ab321554a2dd43418c107b418/lib/parser/handler.js#L181-L189

Minimal reproduction

import * as jsonexport from 'jsonexport';

const obj: object = {
  firstname: "Guillaume",
  lastname: "Ongenae",
  height: 187,
  birth: new Date("01/16/1994"),
};

jsonexport(obj)
  .then(console.log)
  .catch(console.error);

Error trace - Actual output

❯ ts-node index.ts
TypeError: this._options.handleDate is not a function
    at Handler.checkComplex (/Users/guillaume/Documents/try/csv/node_modules/jsonexport/lib/parser/handler.js:46:30)
    at Handler.check (/Users/guillaume/Documents/try/csv/node_modules/jsonexport/lib/parser/handler.js:96:17)
    at Parser._parseObject (/Users/guillaume/Documents/try/csv/node_modules/jsonexport/lib/parser/csv.js:159:35)
    at Parser.parse (/Users/guillaume/Documents/try/csv/node_modules/jsonexport/lib/parser/csv.js:34:60)
    at /Users/guillaume/Documents/try/csv/node_modules/jsonexport/lib/index.js:76:12
    at new Promise (<anonymous>)
    at module.exports (/Users/guillaume/Documents/try/csv/node_modules/jsonexport/lib/index.js:75:10)
    at Object.<anonymous> (/Users/guillaume/Documents/try/csv/index.ts:10:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1043:23)

Example output without Date

Just for reference

❯ ts-node index.ts
firstname,Guillaume
lastname,Ongenae
height,187

Versions

  • ts-node: v9.0.0
  • nodejs: 14.13.1
  • jsonexport: v3.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gregz07commented, Dec 30, 2020

sorry for the delay, i just published v3.1.0 @gregz07

Not at all, I just waited a few hours. Thank you for your work!

1reaction
kauecommented, Dec 30, 2020

sorry for the delay, i just published v3.1.0 @gregz07

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select2: Uncaught TypeError: options.results is not a function
1 Answer 1 · Hi . · I am not trying to change the code for the plugin ... but I did just...
Read more >
Uncaught TypeError: options.results is not a function #3728
I am receiving this error: Uncaught TypeError: options.results is not a function Here is my HTML: Here i...
Read more >
Squel.js - SQL query string builder for Javascript - Hiddentao
It is this method which constructs the final query string. Squel does not check to see if your final query is semantically correct...
Read more >
Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >
Mobiscroll getting started guide for plain JS, jQuery, Angular ...
$(function () { // create a datepicker with default settings ... so the DOM ready event is not as useful, as it only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found