fix: Date picker bug
All checks were successful
Deploy to Staging / Build Images (push) Successful in 1m21s
Deploy to Staging / Deploy to Staging (push) Successful in 43s
Deploy to Staging / Verify Staging (push) Successful in 4s
Deploy to Staging / Notify Staging Ready (push) Successful in 4s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2026-03-23 20:03:49 -05:00
parent c05e33e230
commit f0fc427ccd
3 changed files with 8 additions and 3 deletions

View File

@@ -2,10 +2,15 @@
* @ai-summary PostgreSQL connection pool configuration * @ai-summary PostgreSQL connection pool configuration
* @ai-context Shared pool for all feature repositories * @ai-context Shared pool for all feature repositories
*/ */
import { Pool } from 'pg'; import { Pool, types } from 'pg';
import { logger } from '../logging/logger'; import { logger } from '../logging/logger';
import { appConfig } from './config-loader'; import { appConfig } from './config-loader';
// Override DATE type parser to return plain YYYY-MM-DD strings instead of Date objects.
// Default pg behavior creates Date objects at local midnight, which shift dates when
// serialized to JSON via toISOString() (UTC conversion) for clients in other timezones.
types.setTypeParser(1082, (val: string) => val);
export const pool = new Pool({ export const pool = new Pool({
connectionString: appConfig.getDatabaseUrl(), connectionString: appConfig.getDatabaseUrl(),
max: 10, max: 10,

View File

@@ -335,7 +335,7 @@ export const MaintenanceRecordEditDialog: React.FC<MaintenanceRecordEditDialogPr
<Grid item xs={12} sm={6}> <Grid item xs={12} sm={6}>
<DatePicker <DatePicker
label="Service Date *" label="Service Date *"
value={formData.date ? dayjs(formData.date) : null} value={formData.date ? dayjs(String(formData.date).substring(0, 10)) : null}
onChange={(newValue) => onChange={(newValue) =>
handleInputChange('date', newValue?.format('YYYY-MM-DD') || '') handleInputChange('date', newValue?.format('YYYY-MM-DD') || '')
} }

View File

@@ -335,7 +335,7 @@ export const MaintenanceScheduleEditDialog: React.FC<MaintenanceScheduleEditDial
<Grid item xs={12}> <Grid item xs={12}>
<DatePicker <DatePicker
label="Due Date" label="Due Date"
value={formData.fixedDueDate ? dayjs(formData.fixedDueDate) : null} value={formData.fixedDueDate ? dayjs(String(formData.fixedDueDate).substring(0, 10)) : null}
onChange={(newValue) => onChange={(newValue) =>
handleInputChange('fixedDueDate', newValue?.format('YYYY-MM-DD') || undefined) handleInputChange('fixedDueDate', newValue?.format('YYYY-MM-DD') || undefined)
} }