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

Query builder - date column custom format

Hello,

I have updated to ej2@17.4.43 version. I have query builder with date and custom format "d. M. y". It worked before update, but it does not and throws error with message "Error: Format options or type given must be invalid". I can't figure out how to change format to make it work. Can you provide any information?


1 Reply

SD Saranya Dhayalan Syncfusion Team January 23, 2020 11:29 AM UTC

Hi Stefan, 
 
Thank you for contacting Syncfusion support, 
 
We have checked your reported query. We would like to let you know that if you load your culture file, the Querybuilder is loaded based on that culture file. You don’t need to specify the format. Please find the below code snippet: 
 
Packages.json: 
 
"dependencies": { 
        "@syncfusion/ej2-querybuilder": "*", 
        "cldr-data": "^36.0.0" 
    }, 
System.config.js 
 
    map: { 
        app: 'app', 
 
        //Syncfusion packages mapping 
        "@syncfusion/ej2-base": "syncfusion:ej2-base/dist/ej2-base.umd.min.js", 
        "@syncfusion/ej2-data": "syncfusion:ej2-data/dist/ej2-data.umd.min.js", 
        "@syncfusion/ej2-inputs": "syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js", 
        "@syncfusion/ej2-buttons": "syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js", 
        "@syncfusion/ej2-splitbuttons": "syncfusion:ej2-splitbuttons/dist/ej2-splitbuttons.umd.min.js", 
        "@syncfusion/ej2-lists": "syncfusion:ej2-lists/dist/ej2-lists.umd.min.js", 
        "@syncfusion/ej2-popups": "syncfusion:ej2-popups/dist/ej2-popups.umd.min.js", 
        "@syncfusion/ej2-calendars": "syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js", 
        "@syncfusion/ej2-dropdowns": "syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js", 
        "@syncfusion/ej2-querybuilder": "syncfusion:ej2-querybuilder/dist/ej2-querybuilder.umd.min.js", 
        "cldr-data": "npm:cldr-data", 
        "plugin-json": "npm:systemjs-plugin-json/json.js" 
    }, 
    meta: { 
        '*.json': { loader: 'plugin-json' } 
    }, 
    packages: { 
        'app': { main: 'app', defaultExtension: 'js' }, 
        'cldr-data': { main: 'index.js', defaultExtension: 'js' } 
   
 
App.ts 
 
import { QueryBuilder, ColumnsModel, ChangeEventArgs } from '@syncfusion/ej2-querybuilder'; 
import { DatePicker } from '@syncfusion/ej2-calendars'; 
import { loadCldr, setCulture } from '@syncfusion/ej2-base'; 
declare var require: any; 
 
loadCldr( 
    require('cldr-data/main/de/ca-gregorian.json'), 
    require('cldr-data/main/de/numbers.json'), 
    require('cldr-data/main/de/timeZoneNames.json') 
); 
    let qryBldrObj: QueryBuilder = new QueryBuilder({ 
        width: '70%', 
        columns: columnData, 
        change: (args: ChangeEventArgs) => { 
            setCulture('de'); 
       
    }); 
    qryBldrObj.appendTo('#querybuilder'); 
setCulture('de'); 
 
In Querybuilder component we will dynamically render the other components. So that we set the culture in change event. 
 
For your convenience we have prepared a sample. Please find the below sample link: 
 
 
 
For you reference please find the below doc link: 
 
 
Could you please check the above sample and get back to us if you need further assistance on this? 
 
Regards, 
Saranya D 


Loader.
Up arrow icon