ShammyLevva / FTAnalyzer

Family Tree Analyzer - Finds hidden details in your family tree. Install at
http://www.ftanalyzer.com/install
Apache License 2.0
56 stars 23 forks source link

[BUG] Import fails with Error parsing date for today 01 MEI 2021 #221

Closed ennoborg closed 3 years ago

ennoborg commented 3 years ago

Master Retrieved May 1, 2021.

Describe the bug When I import a GEDCOM file, everything seems to be OK, up to phase 4, which ends with the following Error:

Schermafdruk van 2021-05-01 20-42-37

To Reproduce Steps to reproduce the behavior:

  1. Make sure that you're working on a PC with non English culture setting, and different month names,
  2. Import a GEDCOM,
  3. See error.

Expected behavior There should never be a problem processing the date of today.

Additional context In May, my system will use Mei for the month name, which triggers the error. The date check should be performed with an English culture setting.

ShammyLevva commented 3 years ago

Interesting, of course my system is English language and I've no reliable way of testing on other languages, so I wasn't aware there was an issue here. It appears that whilst I do a static FactDate.TODAY it's not used in a couple of calculations and those reverts back to DateTime.Now's without enforcing en-GB locale to make a suitable comparative. I've replaced them with using the originally converted Now so that should hopefully fix the issue. As I say I've no means of confirming this reliably so if you can check the committed code (in FTAnalyzer.Shared) and let me know if that fixed it please.

ennoborg commented 3 years ago

Did you push that fix? I can't see that on the initial branch, but you can see what I did here:

https://github.com/ennoborg/FTAnalyzer.Shared/commit/564e11d2a521ed02712e74fb54cc43726c069631

Note that you may be able to test this on an English windows by setting the date and time location to Dutch, which will result in May appearing as Mei, or German, which will result in Mai.

ShammyLevva commented 3 years ago

Yup two commits today https://github.com/ShammyLevva/FTAnalyzer.Shared/commits/initial https://github.com/ShammyLevva/FTAnalyzer.Shared/commit/85bc5d5da2f1b05c363c70212563210e26c64fe2 and https://github.com/ShammyLevva/FTAnalyzer.Shared/commit/73cb92c4619560f3d8879a518970664acaf1cc34 (first of the tweaks for some of Tamura's suggestions)

ennoborg commented 3 years ago

H'm, I read those, but don't see how they can affect the parsing of month names, like MEI. The fix that I made was copied from another DateTime.Now.ToString in your existing code.

ennoborg commented 3 years ago

OK, I just checked, and it does help. Thanks.

ShammyLevva commented 3 years ago

The fix you made was effectively included within my fix. The difference was I'd noted I'd made TODAY a static already so just used that rather than the direct fix you'd done. So instead of the adding the locale as you did I used the existing static that already had TODAY so effectively it already had the locale.