Primeng: p-calendar issue with ngmodel

Created on 5 Feb 2018  路  5Comments  路  Source: primefaces/primeng

There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeNG PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[ x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
Please fork the plunkr below and create a case demonstrating your bug report. Issues without a plunkr have much less possibility to be reviewed.

http://plnkr.co/edit/Nxca3ovCbtvx9kpGds0q?p=preview

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Getting error: Uncaught (in promise): Unexpected literal at position 2

  • Angular version: 5.2.3

  • PrimeNG version: 5.2.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript 2.5.3 | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

Most helpful comment

You need to convert received date string (probably from some API) to Date:
this.deal.AnnouncementDate = new Date(this.deal.AnnouncementDate);

All 5 comments

You need to convert received date string (probably from some API) to Date:
this.deal.AnnouncementDate = new Date(this.deal.AnnouncementDate);

My object is Date. I am using TypeScript and the type is set to a date.

I ran into this error message also, and initially thought as jbarber - I have a date: Date object in Typescript - so what is the problem? As Pikad said, you don't have a Date object until you "new" it. Typescript will allow you to "let d: Date = '10/2/2012'" (Typescript probably should not allow this), but that is not the same as "let d: Date = new Date('10/2/2012')". I think this issue can be closed.

I agree, I figured that out also. My object gets populated from API call, but would like it to work by directly binding and not having to create local variables or doing something custom. Other date controls work without doing this transformation. Such as angular material, I like the primeng much more, so I can live with a minor nuance

I really think this should be handled... I created a PR if @cagataycivici or another maintainer could review, please

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philly-vanilly picture philly-vanilly  路  3Comments

markgoho picture markgoho  路  3Comments

cyberrranger picture cyberrranger  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments

miresk picture miresk  路  3Comments