Skip to content

Commit

Permalink
refactor(isDateStale): name magic constant
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Dec 15, 2024
1 parent 4aec665 commit 78c64ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/date.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { z } from "astro/zod";

const AVG_DAYS_IN_MONTH = 30;

export const ISODateSchema = z.string().date();

export function isDateStale(date: Date) {
const pivot = new Date();
pivot.setUTCDate(pivot.getUTCDate() - 30);
pivot.setUTCDate(pivot.getUTCDate() - AVG_DAYS_IN_MONTH);
return date < pivot;
}

Expand Down

0 comments on commit 78c64ab

Please sign in to comment.