Skip to content

Commit

Permalink
Merge pull request #21 from Qeepsake/change_date_format
Browse files Browse the repository at this point in the history
fix(android): changed date format yyyy-MM-dd'T'HH:mm'Z' to yyyy-MM-dd'T'HH:mm:ss.SSSZ
  • Loading branch information
Luke Brandon Farrell authored Dec 30, 2021
2 parents fac78fb + 6c15312 commit 6d336a9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void getTimestamp(String uri, String mediaType, Promise promise) {
String timestamp = exif.getAttribute(ExifInterface.TAG_DATETIME);

Date date = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.US).parse(timestamp);
String formattedDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'", Locale.US).format(date);
String formattedDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US).format(date);

promise.resolve(formattedDate);
} else {
Expand All @@ -171,7 +171,7 @@ public void getTimestamp(String uri, String mediaType, Promise promise) {
MediaMetadataRetriever retriever = GetMediaMetadataRetriever(fileUri);
String timestamp = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE);
Date date = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.US).parse(timestamp);
String formattedDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'", Locale.US).format(date);
String formattedDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US).format(date);
retriever.release();

promise.resolve(formattedDate);
Expand Down

0 comments on commit 6d336a9

Please sign in to comment.