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

Default date format

Hi,

Currently if I initialize a ejs-datepicker by default the dateformat is set to 'm/dd/yyyy' . I know I can change it by  using the format attribute. What I need to know is there a way to set application wide default format rather than for each component.

Also is there a way to create a masked date picker which looks like the image below

enter image description here

1 Reply

DL Deepa Loganathan Syncfusion Team March 20, 2019 11:13 AM UTC

Hi Sahal,  
 
Thanks for contacting Syncufsion support.  
 
Query: Set common format for all the controls 
 
We would like to let you know that the date format and the number formats of the EJ controls will be set based on the applications’ culture set by using setCulture method. The default culture is ‘en-Us’ and there is no default option to override the date format other than the format API.  
 
Rather, you could set the default format by using a common property in your application as given below. 
 
[App.component.html] 
 
export class DefaultDateTimePickerComponent { 
 
    public date: Object = new Date(); 
 
    public format:string = "dd/MM/yyyy HH:mm" // common format as a model value. 
 
} 
 
[App.component.ts] 
 
<div id="control_wrapper"> 
        <ejs-datetimepicker [format]="format"></ejs-datetimepicker> 
        <ejs-datepicker [format]="format"></ejs-datepicker> 
    </div> 
 
 
Query: Mask enabled Datepicker 
 
Currently, Datetimepicker component does not support masking of date input. However, we have considered this as a feature request and logged in our database to implement it in any of our upcoming releases.   
  
Please follow the below link to keep track of the status of this feature.   
  
Feedback portal link:  
  
Please do cast your vote to show your interest for this feature. If you have any specific requirement for this feature in your application, you can describe it in the comments section. We will consider this in defining this feature in our initial implementation itself.  
 
Please let us know if you have any further queries. 
 
Regards,  
Deepa L. 


Loader.
Live Chat Icon For mobile
Up arrow icon