DateTimePicker in Excel Grid filtering wrong format

Hello,

I have a grid like this. However when I want to filter (Excel style) on DateTime column the DateTimePicker does not keep the dateformat of the column. 1) Where can I set the format of the DateTimePicker?

2) I also do not want to select a time in dropdown for every 30 minutes, but is there a sort of clock selector (like last picture)?

3) Lastly the data in the column is also not formatted correctly. If I send the data as  2025-03-28 10:00:32.123 then the datetime filter does NOT ​load. I have to send the data as  2025-03-28T10:00:32.123 to make the filter load but then the milliseconds do not work anymore in the grid column and just show 000.

Greeting Stefan

<ejs-grid #grid [id]="idGrid" [dataSource]='parentData' [height]='height' [allowPaging]="true" [allowSorting]="true"
    [allowFiltering]="true" [pageSettings]='pageSettings' [filterSettings]="filterOptions"
    allowReordering="true" allowResizing="true" [toolbar]='toolbarOptions' [showColumnChooser]='true'
    [sortSettings]="sortSettings" [enablePersistence]="persistence" (toolbarClick)="toolbarClick($event)"
    (beforeDataBound)='dataBound($event)'>
    <e-columns>
        <e-column field='lpn' headerText='Lpn' type='string' width=70></e-column>
        <e-column field='trayOrderNumber' headerText='Tray Order Number' width=100></e-column>
        <e-column field='messageType' headerText='Type' width=100></e-column>
        <e-column field='message' headerText='Message' width=180></e-column>
        <e-column field='scannerId' headerText='Scanner Id' width=100></e-column>
        <e-column field='scannerName' headerText='Scanner Name' width=100></e-column>
        <e-column field='direction' headerText='Direction' width=80></e-column>
        <e-column field='user' headerText='User' width=80></e-column>
        <e-column field='conveyorTime' headerText='Conveyor Time' width=120 type="datetime" format='yyyy-MM-dd HH:mm:ss.fff'></e-column>
        <e-column field='pcdTime' headerText='Pcd Time' width=120 type="datetime" format='yyyy-MM-dd HH:mm:ss.fff'></e-column>
    </e-columns>
</ejs-grid>

Image_4094_1743404890251


Attachment: pictures_Syncfusion_48486f19.zip

1 Reply 1 reply marked as answer

SI Santhosh Iruthayaraj Syncfusion Team April 3, 2025 01:17 PM UTC

Hi Stefan Habets,


Greetings from Syncfusion Support.


Query 1: Where can I set the format of the DateTimePicker?


The format of the DateTimePicker within the Excel Filter’s custom filters is determined by the “columns.format” property. However, the reason the format is not applied to the DateTimePicker inside the filter in your Grid is because a custom format has been set for the date column as a string.


To correctly define a custom format for a date column, use a formatOptions object containing both the “format” and “type” fields. This ensures that the column format is applied to the DateTimePicker within the custom filters. Please refer to the modified code snippet below:


 

<e-column

  field="conveyorTime"

  headerText="Conveyor Time"

  width="120"

  type="dateTime"

  [format]="type'dateTime'format'yyyy-MM-dd HH:mm:ss.fff' }"

></e-column>

<e-column

  field="pcdTime"

  headerText="Pcd Time"

  width="120"

  type="dateTime"

  [format]="type'dateTime'format'yyyy-MM-dd HH:mm:ss.fff' }"

></e-column>

 


For more information on setting a custom format for date columns, please refer to the following documentation:


Documentation: Date formatting in Angular Grid component | Syncfusion


Query 2: If I send the data as  2025-03-28 10:00:32.123 then the datetime filter does NOT ​load. I have to send the data as 2025-03-28T10:00:32.123 to make the filter load but then the milliseconds do not work anymore.


To ensure the DateTime filter functions correctly and retains milliseconds in the Grid column, the date values must be provided in a specific format:

  1. For Local Data (Array of Objects):
    • The date values should be provided as JavaScript Date objects.
  2. For Remote Data (DataManager):
    • The date values should be returned as a UTC string in the following format:
      yyyy-MM-ddTHH:mm:ss.fffZ (e.g., 2024-04-03T15:30:45.123Z)
    • The "Z" at the end of the string indicates that the value represents a UTC timestamp, allowing the Grid to process the date correctly. Ensure that the server returns the date in this format.


Query 3: I also do not want to select a time in dropdown for every 30 minutes, but is there a sort of clock selector (like last picture)?


Currently, the Syncfusion DateTimePicker/TimePicker does not support a clock UI for time selection. However, We have considered the request for “Need to provide a clock UI for selecting time in the TimePicker” as a feature, but there are no immediate plans to implement it. During the planning phase for each release cycle, we review all open feature requests and prioritize them based on factors such as feature ranking, customer demand, and overall popularity.


You can track the implementation status through the following link: 

Need to provide a clock UI for selecting time in the TimePicker in Angular | Feedback Portal


To help prioritize this feature, please cast your vote. If you have any additional specifications or suggestions, feel free to add them as a comment in the portal.


Note: If this feature is implemented for TimePicker, it will also be available in the DateTimePicker component.


Regards,

Santhosh I


Marked as answer
Loader.
Up arrow icon