Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2085] file.createTimeStamp returns unexpected date on iOS 3.2.2 and earlier

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:58:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ComponentsiOS
Labelscreatetimestamp, defect, ios
ReporterThomas Huelbert
AssigneeStephen Tramer
Created2011-04-15T03:09:59.000+0000
Updated2011-04-17T01:58:03.000+0000

Description

spun off of #1642

1.run the script below on an an iOS device running 3.2.2 or older.

var filename = 'iphone_coming_soon.png'; var timeStampOfFile = ''; var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename); if ( file.exists() ) { Ti.API.info('IF IS TRUE'); timeStampOfFile = file.createTimestamp(); }

Ti.API.info('The value of timeStampOfFile is: ' + timeStampOfFile);

results: [INFO] newfile.txt created: Wed Dec 31 1969 16:00:00 GMT-0800 (PST)

expected: return actual date,

notes: Setting to medium

Comments

  1. Stephen Tramer 2011-04-15

    Could be an Apple bug. Looking into it.

  2. Stephen Tramer 2011-04-15

    This is indeed an Apple bug. There is a workaround but it WILL return different file creation dates on 3.x and 4.x (we spoof the creation date with the modification date on 3.x - they're similar, but may differ by a few seconds).

    Will patch the fix into 1_4_X when approved.

  3. Jeff Haynie 2011-04-15

    (from [9977c7719107da0d1281fd50b487667c73d194c9]) [#2085] Added test in KS 'Filesystems'. http://github.com/appcelerator/titanium_mobile/commit/9977c7719107da0d1281fd50b487667c73d194c9"> http://github.com/appcelerator/titanium_mobile/commit/9977c7719107d...

  4. Jeff Haynie 2011-04-15

    (from [c6164c4d92c302ff3582ceb3bb76727cf7aa57e0]) [#2085 state:fixed-in-qa] Spoof file modification date as creation date when creation date is not available (3.x Apple bug for initially installed files) http://github.com/appcelerator/titanium_mobile/commit/c6164c4d92c302ff3582ceb3bb76727cf7aa57e0"> http://github.com/appcelerator/titanium_mobile/commit/c6164c4d92c30...

  5. Tim.Alosi 2011-04-15

    This also appears to be an issue with file.modificationTimestamp() ... I assume you noticed, but it wasn't listed.

    Tim

    See below for example output.
    Ti.API.debug('Images.getImageUrl image details Create:Modify = ' + String(new Date(imageFile.createTimestamp())) +':'+String(new Date(imageFile.modificationTimestamp())));

    Renders
    [DEBUG] Images.getImageUrl image details Create:Modify = Wed Dec 31 1969 19:00:00 GMT-0500 (EST):Wed Dec 31 1969 19:00:00 GMT-0500 (EST)

  6. Stephen Tramer 2011-04-15

    This does not occur under 3.1.x.

       [INFO] created = Sun Oct 17 2010 22:58:21 GMT-0700 (PDT)
       [INFO] modified = Sun Oct 17 2010 22:58:21 GMT-0700 (PDT)
       

    Thom, can you confirm whether or not the modification bug appears in 3.2 ONLY?

  7. Thomas Huelbert 2011-04-15

    I am unable to repro the incorrect behavior on a 3.2.2 device - using 1.5.0.62c1cae the test works as expected.

JSON Source