NativeScript / NativeScript/plugins

[@nativescript/datetimepicker] Form with date field in Angular

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
206
Forks
123
Avg merge
2d 1h
Merged PRs (30d)
1

Description

Hello,

I use formGroup to do my forms in my app so I used to define my form fields with formControlName like this :

<TextField formControlName="kilometers" keyboardType="number"></TextField>

But when I put it with the datePickerField, my date variable to set the current date doesn't work anymore and it puts 1 january 1970 and when I click on the field 1 january 1900.
As soon as I remove my formControlName value, it works without any issue, like if there was a conflict between date and formControlName :

<DatePickerField #date formControlName="date" [date]="dateRefuel" [pickerTitle]="'Refuel.DateTitle' | L" [maxDate]="dateRefuel"></DatePickerField>

Do you have any idea how to fix this ? The only solution that I found is to put the #date and extract the value when I click on my send form button.

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DatePickerField Angular formControlName example in the issue and compare its behavior with the same field without formControlName. Reproduce the current-date binding and picker interactions; done means the date no longer becomes 1 January 1970 or 1900 while remaining usable in the form.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.