[TIMOB-2085] file.createTimeStamp returns unexpected date on iOS 3.2.2 and earlier
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:58:02.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 |
Components | iOS |
Labels | createtimestamp, defect, ios |
Reporter | Thomas Huelbert |
Assignee | Stephen Tramer |
Created | 2011-04-15T03:09:59.000+0000 |
Updated | 2011-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
Could be an Apple bug. Looking into it.
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.
(from [9977c7719107da0d1281fd50b487667c73d194c9]) [#2085] Added test in KS 'Filesystems'. http://github.com/appcelerator/titanium_mobile/commit/9977c7719107da0d1281fd50b487667c73d194c9"> http://github.com/appcelerator/titanium_mobile/commit/9977c7719107d...
(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...
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)
This does not occur under 3.1.x.
Thom, can you confirm whether or not the modification bug appears in 3.2 ONLY?
I am unable to repro the incorrect behavior on a 3.2.2 device - using 1.5.0.62c1cae the test works as expected.