We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error when grouping or Exporting to PDF when having a column with custom DateTime Format

Good Afternoon.

I have a problem when i am dragging a date time column to the group drop area when the column having custom format.
Also I have problem when i am trying to export to a pdf file when i have a date time column with custom format.

It raises error: TypeError: value.getDate is not a function

<e-column field='OrderDate' headerText='OrderDate' type='date' width='120' [format]='formatOptions' [enableGroupByFormat]='true'></e-column>

this.formatOptions = { type: 'dateTime', skeleton: 'short' };
this.formatOptions = { type: 'dateTime', format: 'dd/MM/yyyy hh:mm:ss a' };

Thank you.

Attachment: Project_c1758233.7z

3 Replies

PS Pavithra Subramaniyam Syncfusion Team May 14, 2019 04:04 AM

Hi Isaias, 
Thanks for contacting Syncfusion support. 
We suspect that you are binding date column value as string type but grid expects value as date object which might be the cause of the reported behavior. So we suggest you to parse the grid data with DataUtil.parse.parseJson method.  . 
import {  DataUtil} from '@syncfusion/ej2-data'; 
    selector: 'app-root', 
    templateUrl: 'a<ejs-grid #grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' [allowExcelExport]='true' [allowPdfExport]='true' [allowGrouping]="true"> 
           <e-column field='OrderDate' headerText='OrderDate' type='date' width='120' [format]='formatOptions' [enableGroupByFormat]='true'></e-column> 
            .  .  . 
export class AppComponent { 
    public ngOnInit(): void { 
        this.data = DataUtil.parse.parseJson([{ 
      .   .  . 
this.formatOptions = { type: 'dateTime', skeleton: 'short' }; 
        .  .  . 
Please get back to us if you need any further assistance on this. 
Pavithra S. 

IC Isaias Chalvatzoglou May 14, 2019 05:20 AM

Hi Pavithra,

Now when I am dragging the date time column I have not problem anymore with grouping.

But the problem with grid exporting when date time column is grouped still remains.

ERROR Error: Uncaught (in promise): TypeError: value.getDate is not a function
TypeError: value.getDate is not a function
    at date-formatter.js:93
    at ExportValueFormatter.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/export-helper.js.ExportValueFormatter.returnFormattedValue (export-helper.js:257)
    at ExportValueFormatter.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/export-helper.js.ExportValueFormatter.formatCellValue (export-helper.js:306)
    at PdfExport.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processGroupedRecords (pdf-export.js:294)
    at PdfExport.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processGridExport (pdf-export.js:199)
    at pdf-export.js:128
    at new ZoneAwarePromise (zone.js:910)
    at PdfExport.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processExport (pdf-export.js:127)
    at pdf-export.js:111
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at resolvePromise (zone.js:831)
    at resolvePromise (zone.js:788)
    at zone.js:892
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:16147)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:502)
    at ZoneTask.invoke (zone.js:487)

Thank you for your quick response!

PS Pavithra Subramaniyam Syncfusion Team May 15, 2019 12:39 AM

Hi Isaias, 

We have logged “Script error occurs while exporting the grouped Grid with enableGroupByFormat feature” as a defect and the fix for this issue will be available in our upcoming patch release on May 22nd, 2019. Until then We appreciate your patience. 

Pavithra S. 

Live Chat Icon For mobile
Up arrow icon