mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-09 15:07:10 +02:00
feat(req-viewer): added today on since/until, added window-title (#221)
This commit is contained in:
committed by
GitHub
parent
fdc7b1499f
commit
0b3c657705
@@ -489,7 +489,7 @@ export function CreateSpellDialog({
|
||||
onChange={(e) => setSince(e.target.value)}
|
||||
/>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{["now", "1h", "24h", "7d", "30d"].map((t) => (
|
||||
{["today", "now", "1h", "24h", "7d", "30d"].map((t) => (
|
||||
<button
|
||||
key={t}
|
||||
onClick={() => setSince(t)}
|
||||
|
||||
@@ -430,6 +430,12 @@ function parseTimestamp(value: string): number | null {
|
||||
return Math.floor(Date.now() / 1000);
|
||||
}
|
||||
|
||||
if (value.toLowerCase() === "today") {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
return Math.floor(today.getTime() / 1000);
|
||||
}
|
||||
|
||||
if (/^\d{10}$/.test(value)) {
|
||||
return parseInt(value, 10);
|
||||
}
|
||||
|
||||
@@ -538,6 +538,12 @@ function parseTimestamp(value: string): number | null {
|
||||
return Math.floor(Date.now() / 1000);
|
||||
}
|
||||
|
||||
if (value.toLowerCase() === "today") {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
return Math.floor(today.getTime() / 1000);
|
||||
}
|
||||
|
||||
// Unix timestamp (10 digits)
|
||||
if (/^\d{10}$/.test(value)) {
|
||||
return parseInt(value, 10);
|
||||
|
||||
@@ -213,12 +213,12 @@ export const manPages: Record<string, ManPageEntry> = {
|
||||
{
|
||||
flag: "--since <time>",
|
||||
description:
|
||||
"Events after timestamp (unix timestamp, relative: 30s, 1m, 2h, 7d, 2w, 3mo, 1y, or 'now')",
|
||||
"Events after timestamp (unix timestamp, relative: 30s, 1m, 2h, 7d, 2w, 3mo, 1y, 'today' or 'now')",
|
||||
},
|
||||
{
|
||||
flag: "--until <time>",
|
||||
description:
|
||||
"Events before timestamp (unix timestamp, relative: 30s, 1m, 2h, 7d, 2w, 3mo, 1y, or 'now')",
|
||||
"Events before timestamp (unix timestamp, relative: 30s, 1m, 2h, 7d, 2w, 3mo, 1y, 'today' or 'now')",
|
||||
},
|
||||
{
|
||||
flag: "--search <text>",
|
||||
|
||||
Reference in New Issue
Block a user