Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

How to do the Date format in ui-grid

Hi,  I tried this and it is not working for me. Dates are now displayed as 2015-02-03T05:49:54.850Z. Any suggestions plz.
$scope.gridOptions = {
data: 'mydata',
enableRowSelection: true,
multiSelect: false,
enableColumnResize: true,
columnDefs: [
{ field: 'startDate', displayName: 'Date',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }]};

Open in new window



Thanks
0
KavyaVS
Asked:
KavyaVS
  • 3
  • 3
3 Solutions
 
Ioannis ParaskevopoulosCommented:
Which version of ui-grid are you using?
If you are using the latest, you should also provide a name for each columnDef.

Do you get any errors in the console??

Giannis
0
 
BigRatCommented:
These are the options for the Grid, the Grid itself will be made (I hope) from an HTML template. Can you post the template? Or are you using a standard grid?
0
 
KavyaVSAuthor Commented:
I am using version 3 .In the module declaration I am injecting [ui.grid] .I am not getting any console errors.

I already posted the code I am using for Date formatting.But is is not working. Dates are displaying as 2015-02-03T05:49:54.850Z. But I want it as yyyy-MM-dd with out any time zone,hours,mins etc., Thanks
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
BigRatCommented:
What do you have as data? The docs say that it must be a Date object, amongst others. But if the Javascript "variable" in the data is a string, then the type must be string and not date.
0
 
KavyaVSAuthor Commented:
I tried the type as string. But still not working.
0
 
BigRatCommented:
I'd really like to see the data source, but I suspect that it is a string. It is very important to know EXACTLY what we are dealing with in order to get the correct filter.

See http://brianhann.com/6-ways-to-take-control-of-how-your-ui-grid-data-is-displayed/ for example!
0
 
KavyaVSAuthor Commented:
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now