Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: validate calendar dates and reject future birth dates

Adam Eivy4ee4f2f2e473
diff --git a/package-lock.json b/package-lock.json
index 25aef0cbcf..a070af2e32 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "portos",
- "version": "1.8.4",
+ "version": "1.8.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "portos",
- "version": "1.8.4",
+ "version": "1.8.5",
"license": "MIT",
"dependencies": {
"express": "^4.21.2",
diff --git a/package.json b/package.json
index 2d593e5fa4..b0ec043356 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "portos",
- "version": "1.8.4",
+ "version": "1.8.5",
"private": true,
"description": "Local dev machine App OS portal",
"author": "Adam Eivy (@antic|@atomantic)",
diff --git a/server/lib/identityValidation.js b/server/lib/identityValidation.js
index c04a7d0730..169edc251b 100644
--- a/server/lib/identityValidation.js
+++ b/server/lib/identityValidation.js
@@ -16,15 +16,20 @@ export const chronotypeBehavioralInputSchema = z.object({
// --- Longevity Schemas ---
+const validCalendarDate = z.string()
+ .regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be YYYY-MM-DD format')
+ .refine((value) => {
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return false;
+ const [y, m, d] = value.split('-').map(Number);
+ return date.getUTCFullYear() === y && date.getUTCMonth() + 1 === m && date.getUTCDate() === d;
+ }, 'Must be a valid calendar date');
+
export const birthDateInputSchema = z.object({
- birthDate: z.string()
- .regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be YYYY-MM-DD format')
- .refine((value) => {
- const date = new Date(value);
- if (Number.isNaN(date.getTime())) return false;
- const [y, m, d] = value.split('-').map(Number);
- return date.getUTCFullYear() === y && date.getUTCMonth() + 1 === m && date.getUTCDate() === d;
- }, 'Must be a valid calendar date')
+ birthDate: validCalendarDate.refine(
+ (value) => new Date(value) <= new Date(),
+ 'Birth date cannot be in the future'
+ )
});
// --- Goal Schemas ---
@@ -56,5 +61,5 @@ export const updateGoalInputSchema = z.object({
export const addMilestoneInputSchema = z.object({
title: z.string().min(1).max(200),
- targetDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be YYYY-MM-DD format').optional()
+ targetDate: validCalendarDate.optional()
});