refactor: centralize validation, error handling, and formatting logic
Extract shared auth logic and validation rules to shared/auth.ts Introduce utility functions for HTTP errors and user input parsing Standardize error messages and date formatting across the app
This commit is contained in:
10
app/utils/formatters.ts
Normal file
10
app/utils/formatters.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export function formatDateTime(value: string | null, fallback = 'Not available') {
|
||||
if (!value) {
|
||||
return fallback
|
||||
}
|
||||
|
||||
return new Intl.DateTimeFormat('en-MY', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short'
|
||||
}).format(new Date(value))
|
||||
}
|
||||
Reference in New Issue
Block a user