enhanced deadline parsing
This commit is contained in:
@@ -1685,13 +1685,15 @@ function extractDeadlineFromPostText(postElement) {
|
||||
];
|
||||
|
||||
const extractTimeAfterIndex = (text, index) => {
|
||||
const tail = text.slice(index, index + 40);
|
||||
const timeMatch = /^\s*(?:[,;:-]|\b)?\s*(?:um|ab|bis)?\s*(?:ca\.?)?\s*(\d{1,2})[:.](\d{2})\s*(?:uhr|h)?/i.exec(tail);
|
||||
const tail = text.slice(index, index + 80);
|
||||
const timeMatch = /^\s*(?:[,;:-]|\b)?\s*(?:um|ab|bis|gegen|spätestens)?\s*(?:den|dem|am)?\s*(?:ca\.?)?\s*(\d{1,2})(?:[:.](\d{2}))?\s*(?:uhr|h)?/i.exec(tail);
|
||||
if (!timeMatch) {
|
||||
return null;
|
||||
}
|
||||
const hour = parseInt(timeMatch[1], 10);
|
||||
const minute = parseInt(timeMatch[2], 10);
|
||||
const minute = typeof timeMatch[2] === 'string' && timeMatch[2].length
|
||||
? parseInt(timeMatch[2], 10)
|
||||
: 0;
|
||||
if (Number.isNaN(hour) || Number.isNaN(minute)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user