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

Component: Calendar isn't show initial value from FormControl/ngModel #14616

Closed
dreyliky opened this issue Jan 23, 2024 · 7 comments
Closed

Component: Calendar isn't show initial value from FormControl/ngModel #14616

dreyliky opened this issue Jan 23, 2024 · 7 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@dreyliky
Copy link

Describe the bug

The calendar that binded to FormControl isn't shown the initial value from FormControl - check screen.

dateFormat - yy-mm-dd
dataType - string

But then, if I change the date in the overlay by picking the date manually - it updates the value in the "input" element.

image

Environment

Angular 17, PrimeNG 17.3.3

https://stackblitz.com/edit/4gkycx?file=src%2Fapp%2Fdemo%2Fcalendar-reactive-forms-demo.html

Reproducer

https://stackblitz.com/edit/4gkycx?file=src%2Fapp%2Fdemo%2Fcalendar-reactive-forms-demo.html

Angular version

17.0.5

PrimeNG version

17.3.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.11.0

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@dreyliky dreyliky added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 23, 2024
@davisb10
Copy link
Contributor

I think I found the issue. It was introduced in #14497

That addition now runs the updateModel method, which calls formatDateTime, which then checks if the 'value' is a valid Date object. However, when the value is a string it will return false and then update the value of the form to be null.

This area of the calendar code will need reworked to handle this change.

@mehmetcetin01140 mehmetcetin01140 added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 5, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.6.0 milestone Feb 5, 2024
@cetincakiroglu
Copy link
Contributor

Reverted the PR that breaks the functionality and causes this issue. Related PR is reverted in here #14750

Thanks for reporting the issue!

@PraveenReddy-4e1
Copy link

PraveenReddy-4e1 commented May 30, 2024

Still it is not working. I am having the date in the ngModel but that is not showing in the calender

@Tsai-Ching
Copy link

It is unstable. I am having the date while the ngModel is not showing in the calender from time to time.

@Berejnec
Copy link

Berejnec commented Aug 1, 2024

Still not working. Date is not showing from time to time.

@sdmakwana
Copy link

sdmakwana commented Aug 13, 2024

still the same issue occurs I even have date as obj

@heynmi
Copy link

heynmi commented Aug 26, 2024

At a large cap organization, we are upgrading from Angular 16 -> 18 for our internally facing UI that's critical to company operations.

This issue also is also occurring for us after the upgrade. Deployed environments show the date, upgraded code shows an empty box. We've been testing a lot of different approaches but ultimately are getting an unpopulated calendar.

If the box is clicked on, and a date selected, then it does populate, but not on initialization.

It doesn't seem like it matters how the initial date is passed in - "mm/dd/yyyy", or as a Date object, as @sdmakwana commented.

Does anyone have a fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

9 participants