BlazorDatasheet icon indicating copy to clipboard operation
BlazorDatasheet copied to clipboard

Values changes to DateTime in different CultureInfo !

Open piramouns opened this issue 1 year ago • 4 comments

Hi, at first I thank you for this nice component, I appriciate you for sharing it, When we use a different CultureInfo for example persian ( fa-IR ) , after entring a float value in a cell for example 3.5 , component changes it to 1403/3/5 0:00:00 that's a date in persian calendar, How I can fix it?

My regards

piramouns avatar Jun 28 '24 05:06 piramouns

Hi @piramouns does the cell have a type set to DateTime? I'm a bit confused as to why this would happen. Can you share an example?

The only thing is it might be parsing the number as a DateTime? This is handled in CellValue.cs

anmcgrath avatar Jun 29 '24 05:06 anmcgrath

Hi, Thanks for your reply, you can check it via this sample page , https://colifeqm.com/analysis/ge ( the CultureInfo is fa-IR ) I have set cell type as number but it not works, after loading just enter value 3.5 in a cell,

ghost avatar Jun 29 '24 09:06 ghost

Hey, thanks for the example. I was able to reproduce it in your example and on my machine when setting the CultureInfo to fa-IR.

The sheet is trying to figure out the datatype from the string that you enter ("3.5"), it first tries to parse as a number and then tries to parse the date. I don't know anything about the fa-IR culture info, except that I can see that the culture info NumberFormat.NumberDecimalSeperator is set to "٫". If you change it to "." then it'll parse numbers as you mentioned you wanted to.

anmcgrath avatar Jun 29 '24 10:06 anmcgrath

Hi, I really appreciate your effort to find the issue, I try it and back to you , hopefully it works for me too, 👍

ghost avatar Jun 29 '24 11:06 ghost

Any updates on this @piramouns ? Have a look at #116 which may also help with restricting the conversion.

anmcgrath avatar Nov 03 '24 06:11 anmcgrath

Thank you for your email,

At that time You gave the key, it was a problem in cultureinfo , and has been fixed. I appreciate your kind trace.

On Sun, Nov 3, 2024, 09:49 anmcgrath @.***> wrote:

Any updates on this @piramouns https://github.com/piramouns ? Have a look at #116 https://github.com/anmcgrath/BlazorDatasheet/issues/116 which may also help with restricting the conversion.

— Reply to this email directly, view it on GitHub https://github.com/anmcgrath/BlazorDatasheet/issues/88#issuecomment-2453312729, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDHTURHFEQLPO54GQPMD52DZ6W557AVCNFSM6AAAAABKBEZAISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGMYTENZSHE . You are receiving this because you were mentioned.Message ID: @.***>

ghost avatar Nov 03 '24 07:11 ghost