-
Notifications
You must be signed in to change notification settings - Fork 357
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
sort for tables not working with date strings #461
Comments
was it fixed? I see that in version 1.0.0-beta.3-1 it is still an issue |
No it wasn't fixed but there is no clean way of sorting this without being really careful what you do. I suggested including moment.js but the repo admins don't agree that's a good idea yet so I don't have a good idea at the moment. Doing some sketchy Regex on strings is not a smart move. |
We are trying to avoid adding external dependencies to reduce the bundle size. Unless the dependency is used heavily in the project, its not really worth it. We want to be able to fix this without it if possible. That being said, you can always pull |
Can you just do a custom sort? See code snippet in #521 |
Yes of course it's possible to get my date strings sorted manually. And although we shouldn't expect covalent to figure out for us what the string means, a date string is so common it would be nice. The real problem however is that it currently(is it still current?) interprets a date string as a number which becomes the year of the date. That is not correct. I can't look into the code base ATM, I'm on mobile. I think best would be to rethink the interpretation of what is a number and leave the date handling out until either moment.js is included or someone finds a solid well proven way of determining strings being ISO date strings or not. |
Hi, |
any other thing other than moment? |
Bug Report
calling sortData on TdDataTableService with sorting field being a date doesn't work as expected
Screenshots or link to CodePen/Plunker/JSfiddle
What is the expected behavior?
sorting date should sort the dates. But the line
if (!Number.isNaN(Number.parseFloat(compA)) && !Number.isNaN(Number.parseFloat(compB)))
causes Problems. This is beacuse
Number.parseFloat("2018-05-14T00:00:00.000Z")
returns a number. 2018What is the motivation / use case for changing the behavior?
Dates should be sorted properly
Which version of Angular and Material, and which browser and OS does this issue affect?
The text was updated successfully, but these errors were encountered: