-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
groupBy doesn't work with date properties #11
Comments
|
Yeah that's what I'm doing. I guess I thought it would work out of the box with all Ember attribute types. However that would require code to specifically handle Date objects, so I understand if you don't want a special case to handle them. |
FWIW bumped into the same issue and fixed using a computed property to convert the date to string. However, it would be really handy if this case was handled out of the box. Alternatively, have you considered using a custom group by function instead of a key? Like having |
Hi guys, I have noticed the same problem with grouping by date. |
@jelhan TY buddy. I have implemented it. propertyToString: Ember.computed('originalDateProperty', function(){
return `${this.get('originalDateProperty').toDateString()}`
}) |
groupBy does not work if you are trying to group using Ember's date attribute. Suppose we have a model:
And we get data from a JSON endpoint that looks like this:
We have a controller that uses groupBy to group them by the date attribute:
Which we then use in a template:
We would expect the output to be:
However, groupBy puts each of the entries into their own group. Changing the attr in the model from
date
tostring
gives the expected output.The text was updated successfully, but these errors were encountered: