You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, I had a problem with groupBy with dates because my dates were formatted as timestamp, so I changed the format to MM/dd/yyyy before render the view, then it worked. You can format them both server-side as client-side.
To resolve that I use map function to before groupBy, so, on map function I create a new formatted property (MM/dd/yyyy).
It works, but I don't know if that is the better way to do that. (honestly, I didn't like the solution)
ng-repeat="(key, value) in mensagens | map: dateFormatter | groupBy: 'dateFormatted'"
Above solution proposed by @rafaelss95 can work if I want to group by date. But I have a requirement to group by Date as well as time (complete timestamp), and in such cases groupBy is misbehaving. It would be great if someone would investigate the issue.
Activity
rafaelss95 commentedon Jun 19, 2016
What's your data structure?
gbergamo commentedon Jun 20, 2016
Messages = [
{ id: 1, sent: Date(), message: "" },
{ id: 1, sent: Date(), message: "" }
]
It's something like that... 'Sent' is timespam
I want to group messages by MM/dd/yyyy
Thanks
rafaelss95 commentedon Jun 21, 2016
Well, I had a problem with groupBy with dates because my dates were formatted as timestamp, so I changed the format to MM/dd/yyyy before render the view, then it worked. You can format them both server-side as client-side.
gbergamo commentedon Jun 21, 2016
To resolve that I use map function to before groupBy, so, on map function I create a new formatted property (MM/dd/yyyy).
It works, but I don't know if that is the better way to do that. (honestly, I didn't like the solution)
ng-repeat="(key, value) in mensagens | map: dateFormatter | groupBy: 'dateFormatted'"karandesai28 commentedon Jun 1, 2017
Above solution proposed by @rafaelss95 can work if I want to group by date. But I have a requirement to group by Date as well as time (complete timestamp), and in such cases groupBy is misbehaving. It would be great if someone would investigate the issue.
karandesai28 commentedon Jun 1, 2017
@codekraft-studio Thanks for reply. Just to confirm, I mentioned about groupBy, not orderBy. Will it work for groupBy? I'll try from my end though.
karandesai28 commentedon Jun 1, 2017
Well I tried in groupBy, but it didn't work