Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   [Fmx, MacOs] Fehlerhafter FormatSettings.ShortDateFormat auf MacOs ? (https://www.delphipraxis.net/200643-%5Bfmx-macos%5D-fehlerhafter-formatsettings-shortdateformat-auf-macos.html)

Rollo62 10. Mai 2019 16:44


[Fmx, MacOs] Fehlerhafter FormatSettings.ShortDateFormat auf MacOs ?
 
Hallo zusammen,

ich habe wieder einen seltsamen Fehler beim Speichern/Laden via MemIni-File auf Mac.

Das schent beim Speichern durch ShortDateFormat mit 'dd.mm.yy' verkürzt zu werden,
deshalb wird beim Laden ein Zeitwert verändert:
Z.B.:
aus einem Zeitwert 30.12.1899 00:02:15 wird beim Speichern 30.12.99 00:02:15
und beim Rücklesen 30.12.1999 00:02:15

Komischerweise funktioniert es auf Win32 richtig, obwohl da ja eingentlich gleich sein sollte.

Die Ursache liegt beim Format, ein schneller Workaround hier;

Delphi-Quellcode:
  ...
  LFormatSettings := TFormatSettings.Create; //  := FormatSettings;
  LFormatSettings.ShortDateFormat := FormatSettings.ShortDateFormat;
  if LFormatSettings.ShortDateFormat.Length < 10 then
    LFormatSettings.ShortDateFormat := 'dd.mm.yyyy';

  FIniStor.WriteString(Section, Name,  DateTimeToStr( Value, LFormatSettings )); //<-- Normalerweise nimmt das die System FormatSettings
  ...

Kann das sein das MacOs ein anderes Setting bei dem ShortDateSting als Windows hat ?
Wenn ja, warum ?

Bin leider knapp mit der Zeit, deshalb reicht mir im Moment der Workaround.
Aber wäre gut wenn ich wüsste wie das demnächst mal optimal korrigieren könnte.


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:51 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz