fix crawling + correct date/time format
This commit is contained in:
+8
-6
@@ -122,13 +122,13 @@ var AbacusParse = (() => {
|
||||
}
|
||||
|
||||
// Normalized one-line-per-day format used in the dashboard editor:
|
||||
// 2026-10-07 08:00-12:00 13:00-17:24
|
||||
// 2026-10-08 8:24
|
||||
// 07/10/2026 08:00-12:00 13:00-17:24
|
||||
// 08/10/2026 8:24
|
||||
function toText(days) {
|
||||
return days
|
||||
.map((d) => d.intervals.length
|
||||
? `${d.date} ${d.intervals.map((iv) => `${U.fmtTime(iv.start)}-${U.fmtTime(iv.end)}`).join(' ')}`
|
||||
: `${d.date} ${U.fmtDur(d.minutes)}`)
|
||||
? `${U.fmtDate(d.date)} ${d.intervals.map((iv) => `${U.fmtTime(iv.start)}-${U.fmtTime(iv.end)}`).join(' ')}`
|
||||
: `${U.fmtDate(d.date)} ${U.fmtDur(d.minutes)}`)
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
@@ -137,8 +137,10 @@ var AbacusParse = (() => {
|
||||
text.split('\n').forEach((line, n) => {
|
||||
line = line.replace(/#.*/, '').trim();
|
||||
if (!line) return;
|
||||
const m = /^(\d{4}-\d{2}-\d{2})\s+(.+)$/.exec(line);
|
||||
if (!m) return errors.push(`line ${n + 1}: expected "YYYY-MM-DD ..."`);
|
||||
const m = /^(\S+)\s+(.+)$/.exec(line);
|
||||
const date = m && U.parseUserDate(m[1]);
|
||||
if (!date) return errors.push(`line ${n + 1}: expected "dd/mm/yyyy ..."`);
|
||||
m[1] = date;
|
||||
const ivs = ranges(m[2]);
|
||||
if (ivs.length) return days.push({ date: m[1], intervals: union(ivs), minutes: sumIntervals(union(ivs)) });
|
||||
const min = U.parseHours(m[2]);
|
||||
|
||||
Reference in New Issue
Block a user