Skip to content
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

🐛 Date/time fields in grids are sorted alphabetically #81

Open
FH-Inway opened this issue Aug 28, 2023 · 3 comments
Open

🐛 Date/time fields in grids are sorted alphabetically #81

FH-Inway opened this issue Aug 28, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@FH-Inway
Copy link
Collaborator

When clicking on a grid column header, the grid data gets sorted (ascending on first click, descending on second). The sorting always seems to be alphabetically and not take the data type into account. This works for most columns, but date/time columns are an issue.

For example, here is the "Deployed On" column in the "Cloud-hosted instances" grid after the first click (should be sorted ascending):
image

@FH-Inway FH-Inway added the bug Something isn't working label Aug 28, 2023
@FH-Inway
Copy link
Collaborator Author

FH-Inway commented Sep 2, 2023

Date/time colums used to be formatted as "yyyy-MM-dd H:mm", which would result in the correct order when sorting. However, according to #24 , some users receive the date/time information in a format (e.g. " 31/01/2019 01:10") which could not be deserialized into a DateTime. Which is why the data type for those columns was changed to string in 250cfbe and the data is shown in the ui as it is provided by LCS.

The date/time format is controlled by the language preference of the user in LCS. 2LCS uses Json.NET for parsing the JSON data returned from LCS. By default, Json.NET uses the invariant culture (which corresponds with the en-US culture, which is the "English (United States)" language preference in LCS).

One was to solve this would be to get the language preference of the user from LCS.
@TomekMelissa Is there an LCS API that could be used to do that?

Another way would be to provide a parameter in 2LCS were the user could set the language preference.

FH-Inway added a commit to FH-Inway/2LCS that referenced this issue Sep 2, 2023
Only works with LCS language preference set to "English (United States)".

See also microsoft#81
@fraga
Copy link
Contributor

fraga commented Sep 2, 2023

@FH-Inway maybe best way for now is to get system user settings really. In a way should be the same as the settings in LCS.

@FH-Inway
Copy link
Collaborator Author

FH-Inway commented Sep 3, 2023

@fraga Thanks for the suggestion. Yes, I had a similar thought. I think we still would need a fallback, since probably many users have a non-us system setting, but never bothered with changing the language preference of LCS.
Even then, there could be an issue if a user has both a non-us system setting and LCS language preference, but both are not the same (I admit, a bit of a theoretic scenario).
My preference would be to get the language preference from LCS, maybe by scraping it if there is no API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants