react-native-fs icon indicating copy to clipboard operation
react-native-fs copied to clipboard

fix: StatResult ctime type

Open n-kulic opened this issue 2 years ago • 0 comments

This pull request fixes ctime type which is, in fact, a Date value, as evidenced in the stat implementation method:

  • https://github.com/itinance/react-native-fs/blob/master/FS.common.js#L306C17-L306C17
type StatResult = {
  name: ?string;
  path: string;
  size: string;
  mode: number;
  ctime: number; // <-- Invalid type as shown in below stat method
};

// ...

stat(filepath: string): Promise<StatResult> {
  return RNFSManager.stat(normalizeFilePath(filepath)).then((result) => {
    return {
      'path': filepath,
      'ctime': new Date(result.ctime * 1000), // <-- ctime is a Date type, not a number
      ...
    };
  });
}

n-kulic avatar Nov 02 '23 10:11 n-kulic