far2l icon indicating copy to clipboard operation
far2l copied to clipboard

File date should be in localized short date format

Open mgorovoy opened this issue 4 years ago • 2 comments

I'm running latest version of Far2l on macOS Big Sur 11.2.3. It always shows file dates in dd/mm/yyyy format in panels, even though the localized short date format is mm/dd/yyyy. This would be consistent with how Far Manager has always worked on Windows.

mgorovoy avatar May 11 '21 18:05 mgorovoy

I investigated this. The problem is in the file far2l/src/datetime.cpp there is a function named GetDateFormat(). It is hard-coded to return 1. Returning 1 as date format forces all other logic to work as date format is dd/mm/yyyy everywhere. Switching return value to 0 makes all dates displayed as mm/dd/yyyy. Proper fix would be to query current locale via libc and return 0 or 1 depending on the current system locale.

For Gentoo, one can simply place a file into /etc/portage/patches/app-misc/far2l/date-patch.diff with the following contents

diff --git a/far2l/src/datetime.cpp b/far2l/src/datetime.cpp
index 028176c3..c72b3a8e 100644
--- a/far2l/src/datetime.cpp
+++ b/far2l/src/datetime.cpp
@@ -57,7 +57,7 @@ DWORD ConvertYearToFull(DWORD ShortYear)
 
 int GetDateFormat()
 {
-	int Result = 1;
+	int Result = 0;
 	//	GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_IDATE|LOCALE_RETURN_NUMBER,reinterpret_cast<LPWSTR>(&Result),sizeof(Result)/sizeof(WCHAR));
 	return Result;
 }

sancoder avatar Apr 08 '24 19:04 sancoder

After https://github.com/elfmz/far2l/commit/4751f6d0ff03dd66c27c06b9427d48f0618391b0 in Options->Interface settings you can manually customize date-time format.

akruphi avatar May 11 '24 21:05 akruphi