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.

Datepicker eror: date.getMonth is not a function

See original GitHub issue

Issue type

I’m submitting a … (check one with “x”)

  • bug report
  • feature request

Issue description

Current behavior:

I am using the DatePicker component and it returns:

NbCalendarViewModeComponent.html:2 ERROR TypeError: date.getMonth is not a function
    at NbNativeDateService.getMonthName (index.js?b4ac:5532)
    at NbCalendarViewModeComponent.getText (index.js?b4ac:4972)
    at Object.eval [as updateRenderer] (NbCalendarViewModeComponent.html:2)
    at Object.debugUpdateRenderer [as updateRenderer] (core.js?f18e:46485)
    at checkAndUpdateView (core.js?f18e:45467)
    at callViewAction (core.js?f18e:45827)
    at execComponentViewsAction (core.js?f18e:45755)
    at checkAndUpdateView (core.js?f18e:45468)
    at callViewAction (core.js?f18e:45827)
    at execEmbeddedViewsAction (core.js?f18e:45784)

I think it is the same error that the calendar component has #2250

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:11
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
alexsintonicommented, Oct 7, 2020

hi @yggg

you were right, now it works therefore I close this ticket.

I was quite sure to pass a Date and not a string 😦

1reaction
ygggcommented, Oct 1, 2020

Not sure if it’s fixed by #2330 as in the original issue posting the error appears in the NbCalendarViewModeComponent and #2330 fixes errors coming from the NbCalendarDayCellComponent. If someone still facing the issue from NbCalendarViewModeComponent, please check the value of the date property on NbCalendarViewModeComponent. To do this:

  1. Open the picker
  2. Make error appear in the console
  3. On the Elements tab in the dev tools find the nb-calendar-view-mode element and click on it, so it becomes selected
  4. Go to the Console tab and type ng.getComponent($0).date
  5. Post steps to reproduce and a screenshot of the value of the date property from the console here.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

getmonth() is not a function error parsing date - Stack Overflow
getmonth() is not a function error parsing date · 3. It means that d.production_date isn't a date object. · 2. var dt =...
Read more >
Date.getMonth is not a function - Haxe Community
In Haxe 4.0. 0-rc. 3, it appears in JavaScript generated code the date string function is retrieving parts of a date to generate...
Read more >
[Solved] TypeError: date.getDate is not a function - ItsJavaScript
getDate is not a function occurs if we call a getDate() method on the object that is not of type Date object. We...
Read more >
Uncaught TypeError: date.getMonth is not a function - Reddit
getMonth is not a function " error which is causing hell with the execution of the datepicker. The calendar gets wiped clear when...
Read more >
Stuck with an error getMonth() - Google Groups
I would recommend verifying that the cell value is indeed in the format you expect (using a regex) before passing it to the...
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