Fixed date scanning for whatsapp and google images

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-08 16:41:06 -07:00
parent 33b8c0a65b
commit 588a261796
2 changed files with 4 additions and 4 deletions

View File

@ -36,6 +36,7 @@
bottom: 0px;
left: 0px;
right: 0px;
font-size: 0.6em;
}
:host:hover > div {

View File

@ -363,17 +363,16 @@ function triggerWatcher() {
}
} else {
/* Attempt to infer the datestamp from the filename */
let patterns = /WhatsApp Image (20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]) at (.*).(jpeg|jpg)/;
let date = moment(created).format();
let match = file.match(patterns);
let match = file.match(/WhatsApp Image (20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]) at (.*).(jpeg|jpg)/);
if (match) {
date = moment((match[1]+" "+match[2]), "YYYY-MM-DD h.mm.ss a").format();
if (date == "Invalid date") {
date = moment(created).format();
}
} else {
patterns = /(20[0-9][0-9]-?[0-9][0-9]-?[0-9][0-9])[_\-]?([0-9]{6})?/;
match = file.match(patterns);
match = file.match(/(20[0-9][0-9]-?[0-9][0-9]-?[0-9][0-9])[_\-]?([0-9]{6})?/);
if (match) {
if (match[2]) { /* Stamp had time in it */
date = moment((match[1]+""+match[2]).replace(/-/g, ""), "YYYYMMDDHHmmss").format();