DateTime Format

Hi,

Is it possible for Syncfusion to automatically format/parse date from ISO, Zulu to javascript to be used directly without further conversion?  

for example: date from dotnet format like below is totally useless without conversion.
{"datetime":"2017-04-13T09:07:00+08:00","temperature":87 }

Thank you.


5 Replies

DD Dharanidharan Dharmasivam Syncfusion Team November 23, 2017 07:34 AM UTC

Hi Albert, 
 
Thanks for using Syncfusion products. 
 
We have analyzed your query. Yes it is possible to format date from ISO to JavaScript.  To know more about the datetime formatting option available in JS 2, please follow the UG link below. 


Grid :  

Please find the below Plunker for grid sample. 


By default, the number and date values are formatted in ‘en-US’ locale. You can customize this by using locale and format property of Grid.  
 
Chart: 
 
For chart, the ISO format value are parsed to JavaScript date in load event of the control.   


 
Code snippet:  
 
  selector: 'app-container', 
  template: 
  `<ej-chart #chartView id="chart-container" (load)="load($event)" [primaryXAxis]='primaryXAxis' [primaryYAxis]='primaryYAxis' [title]='title'> 
  <e-series-collection> 
    <e-series [dataSource]='data' ></e-series> 
  </e-series-collection> 
  </ej-chart>`, 
 
  public load(args: ILoadedEventArgs): void { 
    let seriesCollection: SeriesModel[] = args.chart.series; 
    for (let series of seriesCollection) { 
      (series.dataSource as object[]).map((a: object) => { a[series.xName] =  new Date(a[series.xName]);}) 
    } 
  } 
 
Screenshot: 

 
 
 
Kindly revert us, if you have any concern. 
  
Thanks, 
Dharanidharan D. 



AK Albert K November 24, 2017 06:32 AM UTC

Hi,

Thanks for the sample.  I would be nice that the DateTime Axis module itself can covert the common datetime format by default.  

The current implementation just crash with getDate() error.  


DD Dharanidharan Dharmasivam Syncfusion Team November 27, 2017 12:01 PM UTC

Hi Albert, 
 
Thanks for your update. 
 
We have analyzed your query. As per your request, we have considered your scenario and logged improvement task on “Need to provide date parsing support when date value is specified in string”. This will be available in upcoming Essential Studio volume 4 sp1 release, which is expected to be out at the end of December.  
 
Kindly revert us, if you have concern on this. 
  
Thanks, 
Dharani. 



AK Albert K November 28, 2017 12:18 AM UTC

Thank you, that is fantastic.   Keep up the good work.


DD Dharanidharan Dharmasivam Syncfusion Team November 28, 2017 08:19 AM UTC

Hi Albert, 

Most welcome. Kindly revert us, if you need further assistance. 

Dharani. 


Loader.
Up arrow icon