Why are date vales on Folderitem wrong?

Originally posted in

Mines way off (I’m in UTC -7)

not only are hours wrong the time is reported wrong as well

Swapping date for datetime & using the newer accessors doesnt seem to change the result at all

EDIT - stat shows the same as Finder

npalardy@Normans-MacBook-Pro ~ % stat /System
16777223 1152921500311902583 drwxr-xr-x 8 root wheel 0 256 "Oct 30 10:07:54 2020" "Oct 30 10:07:54 2020" "Jul 29 07:19:58 2022" "Oct 30 10:07:54 2020" 4096 0 0x80000 /System

EDIT II : its been mentioned


and supposedly fixed

which is obviously not the case :frowning:

#63332 - Time difference between f.CreationDateTime.ToString and info shown in the finder depending on time zone (closed)

#62540 - file.CreationDateTime, when I check the time of the file in question on the Finder (closed)


Or only fixed for .ModificationDateTime as .ModificationDate is deprecated?

This seems to work:

dim f as FolderItem = new FolderItem ("/System", FolderItem.PathModes.Native)
dim d as date = f.ModificationDateTime
Msgbox d.ShortTime

7:36 PM for me if using .ModificationDate (wrong)
8:36 PM for me if using .ModificationDateTime (correct)

I have been doing some tests in the past hours and found out so far:

  • I can only reproduce it with High Sierra, Mojave and Catalina, but not with macOS 11 and later.
  • It only happens with certain files / folders, not with every file on the same system.
  • The bug is real.

I’ll add a test for the ModificationDateTime accessor.

Indeed - it appears that the newer function got eventually fixed but not the older one. :frowning_face:

Here’s the code now. I can now also reproduce the issue on macOS 11 and later - all it needs is a change of the current time zone:

dim fs() as FolderItem = Array (_
new FolderItem ("/System", FolderItem.PathModes.Native), _
new FolderItem ("/tmp/", FolderItem.PathModes.Native), _
SpecialFolder.Desktop.TrueItem(1) )

dim foundOne as Boolean, wrongZT as Integer

for each f as FolderItem in fs
  dim d1 as Date = f.ModificationDateTime
  dim d2 as Date = f.ModificationDate
  dim sh as new Shell
  sh.Execute "stat -f ""%Sm"" -t ""%R"" "+f.ShellPath
  dim statTime as String = sh.Result.Trim
  dim xojoTime as String = d1.ShortTime
  if statTime <> xojoTime then
    foundOne = true
    Msgbox "The ModificationDateTime from Xojo ("+xojoTime+") and the OS ("+statTime+") are different for "+f.NativePath
    xojoTime = d2.ShortTime
    if statTime <> xojoTime then
      foundOne = true
      Msgbox "The ModificationDate from Xojo ("+xojoTime+") and the OS ("+statTime+") are different for "+f.NativePath
    end if
  end if

if not foundOne then
  Msgbox "The times all match. Now please change the Time Zone to any other, preferably something uncommon, e.g. Middle or Eastern Asia. Make sure to leave the Date & Time panel after the change and before running this again."
end if


Bugged here: Xojo: Account Login

Issue #71509 - Time Zone bug since Xojo 2019 with classic Date properties in FolderItem still exists, despite others believing it got magically fixed.

Thanks to @Tim


ModificationDateTime doesnt work here either on Catalina

Sigh… I’ve already contemplated writing my own damn date class because of another bug I found that that is only fixed with the 2.0 ATT version. But now knowing I can’t trust it to display folderitem dates correctly… Sheesh…

@tempelorg I hope that they pay attention to your reports, for most of us here, they don’t.

Could probably lift Charles old implementations out of macOSLib for NSDate and just use that :slight_smile:

I’ll probably use NSDate as the backbone, I already use NSDate and NSDateFormatter because I want custom date and time formatting in Sleep Aid.

1 Like

Have you double checked with Xojo 2022r4.1? It appears to be fixed there for ModificationDateTime.

I haven’t as I dont bother trying to keep up with Xojo’s updates any more
Clients are mostly on Windows so even older versions are sufficient

1 Like

What version of Xojo did you try?

2022r1.1 which is what I use for 99.9% of the work I’m doing
Its the latest version clients are willing to update to - esp for Windows apps
We’re not using API 2 for anything nor Desktop controls etc
There just hasn’t been anything compelling to update for in later releases


I haven’t renewed my license since the launch of DesktopControls.
I do read the release notes for each new release and there’s not been anything there appears to benefit me.
I have told Xojo employees and Xojo MVPs what I need from Xojo and what would make me renew my license. It’s been over a year now, so I must and I really must start new projects in a different tool.

1 Like

You’ll be much happier once you get settled in with a new tool. I am. The only bugs I find in PHP/JS/Bootstrap are the bugs I create.

Xojo needs to fire the Product Manager.