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

Missed casting for the long type #32

Closed
duhapunk opened this issue Nov 4, 2022 · 1 comment · Fixed by #33
Closed

Missed casting for the long type #32

duhapunk opened this issue Nov 4, 2022 · 1 comment · Fixed by #33
Labels
bug Something isn't working

Comments

@duhapunk
Copy link

duhapunk commented Nov 4, 2022

Hello. First of all, thanks for your implementation of PrimeNG filter model. I found tiny bug when I tried to use filter by long type field. You forgot to add cast for the 'long' type.
ObjectCasterUtils.cs:40. Please find missing lines below

if (property?.PropertyType == typeof(int))
     return Convert.ToInt32(value);
if (property?.PropertyType == typeof(long)) // these
     return Convert.ToInt64(value);         // lines
if (property?.PropertyType == typeof(decimal)) // UPD
     return Convert.ToDecimal(value);          // UPD
if (property?.PropertyType == typeof(float)) // UPD
     return Convert.ToSingle(value);         // UPD
if (property?.PropertyType == typeof(double))
     return Convert.ToDouble(value);
if (property?.PropertyType == typeof(DateTime))
     return Convert.ToDateTime(value);
if (property?.PropertyType == typeof(DateTime?))
     return Convert.ToDateTime(value);
if (property?.PropertyType == typeof(bool?))
     return Convert.ToBoolean(value);
if (property?.PropertyType == typeof(short?))
     return Convert.ToInt16(value);
if (property?.PropertyType == typeof(int?))
     return Convert.ToInt32(value);
if (property?.PropertyType == typeof(long?))
     return Convert.ToInt64(value);
if (property?.PropertyType == typeof(float?))
     return Convert.ToSingle(value);
if (property?.PropertyType == typeof(double?))
     return Convert.ToDouble(value);
if (property?.PropertyType == typeof(decimal?))
     return Convert.ToDecimal(value);

return value.ToString();
@duhapunk
Copy link
Author

duhapunk commented Nov 4, 2022

I also noticed that regular 'float' is missing too

@Kusumoto Kusumoto added the bug Something isn't working label Nov 7, 2022
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

Successfully merging a pull request may close this issue.

2 participants