Browse Source

Fix #227 lastModifed date value and format

Ben Hsieh 7 years ago
parent
commit
5c20ca66a3

+ 3
- 3
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java View File

630
                 stat.putString("path", path);
630
                 stat.putString("path", path);
631
                 stat.putString("type", "asset");
631
                 stat.putString("type", "asset");
632
                 stat.putString("size", String.valueOf(fd.getLength()));
632
                 stat.putString("size", String.valueOf(fd.getLength()));
633
-                stat.putString("lastModified", "0");
633
+                stat.putInt("lastModified", 0);
634
             }
634
             }
635
             else {
635
             else {
636
                 File target = new File(path);
636
                 File target = new File(path);
641
                 stat.putString("path", target.getPath());
641
                 stat.putString("path", target.getPath());
642
                 stat.putString("type", target.isDirectory() ? "directory" : "file");
642
                 stat.putString("type", target.isDirectory() ? "directory" : "file");
643
                 stat.putString("size", String.valueOf(target.length()));
643
                 stat.putString("size", String.valueOf(target.length()));
644
-                String lastModified = String.valueOf(target.lastModified());
645
-                stat.putString("lastModified", lastModified);
644
+                int lastModified = (int) target.lastModified();
645
+                stat.putInt("lastModified", lastModified);
646
 
646
 
647
             }
647
             }
648
             return stat;
648
             return stat;

+ 1
- 1
src/ios/RNFetchBlobFS.m View File

494
              @"size" : size,
494
              @"size" : size,
495
              @"filename" : filename,
495
              @"filename" : filename,
496
              @"path" : path,
496
              @"path" : path,
497
-             @"lastModified" : [NSString stringWithFormat:@"%d", [lastModified timeIntervalSince1970]],
497
+             @"lastModified" : [NSNumber numberWithLong:(time_t) [lastModified timeIntervalSince1970]*1000],
498
              @"type" : isDir ? @"directory" : @"file"
498
              @"type" : isDir ? @"directory" : @"file"
499
             };
499
             };
500
     
500