1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Electron: Resolves #755: Added note properties dialog box to view and edit created time, updated time, source URL and geolocation

This commit is contained in:
Laurent Cozic
2018-09-16 19:37:31 +01:00
parent 1b784fe3b0
commit 4e8372174b
11 changed files with 465 additions and 23 deletions

View File

@ -60,6 +60,23 @@ class Time {
return moment(ms).format(format);
}
formatLocalToMs(localDateTime, format = null) {
if (format === null) format = this.dateTimeFormat();
const m = moment(localDateTime, format);
if (m.isValid()) return m.toDate().getTime();
throw new Error('Invalid input for formatLocalToMs: ' + localDateTime);
}
// Mostly used as a utility function for the DateTime Electron component
anythingToDateTime(o, defaultValue = null) {
if (o && o.toDate) return o.toDate();
if (!o) return defaultValue;
let m = moment(o, time.dateTimeFormat());
if (m.isValid()) return m.toDate();
m = moment(o, time.dateFormat());
return m.isValid() ? m.toDate() : defaultValue;
}
msleep(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {