ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.12k stars 1.56k forks source link

Incorrect `modificationDate` on android #1580

Open AmauryLiet opened 3 years ago

AmauryLiet commented 3 years ago

Version

Tell us which versions you are using:

Platform

Expected behaviour

Values of modificationDate returned by openPicker & openCamera gives the timestamp when the photo was created/last edited

Actual behaviour

It systematically returns the current timestamp, even for older images

Steps to reproduce

  1. Use openPicker on an android real device
  2. Choose a photo from a previous day
  3. Log the returned value

I didn't have a chance yet to look into the implementation unfortunately

Thanks for your work!

priyankaThummala commented 3 years ago

@AmauryLiet, I'm facing the issue with modificationDate in the android 10 version and above.

Is there any solutions to resolve this issue...

AmauryLiet commented 3 years ago

@priyankaThummala I couldn't find any workaround unfortunately... From my research, it seems to be an android issue rather than the lib

I also tried https://stackoverflow.com/a/48431255/6529098 but without luck. It could be because a new file is created specifically for the application? (it seems plausible looking at the android path)

priyankaThummala commented 3 years ago

Thank you for your response @AmauryLiet Please mention here if you found any solution

MBrodo commented 2 years ago

I've found a solution!

  1. install momentjs lib (https://momentjs.com);
  2. import it
  3. just divide by 1000 your value from modificationDate. That's it, here is my code example:
    export const getDate = e => {
    return moment.unix(e / 1000).format('MMMM Do YYYY, h:mm:ss a');
    };

    @priyankaThummala , @AmauryLiet

changwoolab commented 7 months ago

@MBrodo Why does that solve the problem? I don't think it could solve the problem.