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; bottom: 0px;
left: 0px; left: 0px;
right: 0px; right: 0px;
font-size: 0.6em;
} }
:host:hover > div { :host:hover > div {

View File

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