date picker intermittently saves wrong date/time to session.

UI Components for Angular
Post Reply
bilpor
Posts: 4
Joined: 03 Mar 2020, 16:03

29 Jun 2020, 12:55

Hi All, We are using version 9.0.6 of the PrimeNG controls. We are using a grid with filtering and one of our filters is a date filter. Sometimes if I enter a date say 17/03/2020 state will save correctly. but sometimes it will save minus 1 hr for no apparent reason. so it will save as 16/03/2020 23 hrs and so mess up the filter.

breakpointing the code. in primeng-table.js line 1224 where it has
this.saveState()
before letting this line run, if I look in the
this.filters
value on line 1219, this value is as expected. but after save state it has saved as date minus 1hr.

My component takes the form :
<ng-template [ngIf]="requestResponseSummaries">
<p-table id="tblRequestResponse" name="tblRequestResponse" [value]="requestResponseSummaries" [rows]="10" [paginator]="true" [columns]="cols" sortField="dateTime" [pageLinks]="3" selectionMode="multiple" [sortOrder]="-1" [(selection)]="selected" stateStorage="session" stateKey="state-relevantDccResponses" #dt>
<ng-template pTemplate="header" let-columns>
<tr>
........

<div *ngSwitchCase="'dateTime'">
{{col.header}} <p-sortIcon [field]="col.field" [pSortableColumn]="col.field"></p-sortIcon>
<p-calendar [inputStyle]="{'width' : '100%'}" appendTo="body" styleClass="ui-column-filter" dateFormat="dd/mm/yy" [(ngModel)]="filterValue[col.field]" (onSelect)="dt.filter($event,col.field,'date')" (onInput)="dt.filter($event.target.value,col.field,'date')" placeholder="Search"></p-calendar>
</div>

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests