Solved

How to do the Date format in ui-grid

Posted on 2016-09-24
7
32 Views
Last Modified: 2016-11-13
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
Comment
Question by:KavyaVS
  • 3
  • 3
7 Comments
 
LVL 23

Assisted Solution

by:Ioannis Paraskevopoulos
Ioannis Paraskevopoulos earned 100 total points
ID: 41814645
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
 
LVL 27

Expert Comment

by:BigRat
ID: 41814664
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
 

Author Comment

by:KavyaVS
ID: 41815253
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 400 total points
ID: 41815835
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
 

Author Comment

by:KavyaVS
ID: 41820363
I tried the type as string. But still not working.
0
 
LVL 27

Accepted Solution

by:
BigRat earned 400 total points
ID: 41841692
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
 

Author Closing Comment

by:KavyaVS
ID: 41885324
Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

You have this traditional web application that refreshes the whole page each time you navigate and you think it's a good time to convert it to a Single-Page approach. What should you know in advance? Read on, I'll guide you through it.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now