@@ -19,20 +19,11 @@ function normalizeUserKind(value: string | undefined | null): NonNullable<UserKi
1919 return "other" ;
2020}
2121
22- function toDate ( value : unknown ) : Date | null {
22+ function toDateString ( value : unknown ) : string | null {
2323 if ( ! value ) return null ;
24- if ( value instanceof Date ) return Number . isNaN ( value . getTime ( ) ) ? null : value ;
25- if ( typeof value === "string" || typeof value === "number" ) {
26- const d = new Date ( value ) ;
27- return Number . isNaN ( d . getTime ( ) ) ? null : d ;
28- }
29- return null ;
30- }
31-
32- function sameDay ( a : Date | null , b : Date | null ) : boolean {
33- if ( ! a && ! b ) return true ;
34- if ( ! a || ! b ) return false ;
35- return a . getTime ( ) === b . getTime ( ) ;
24+ const d = value instanceof Date ? value : new Date ( String ( value ) ) ;
25+ if ( isNaN ( d . getTime ( ) ) ) return null ;
26+ return d . toISOString ( ) . split ( "T" ) [ 0 ] ?? null ;
3627}
3728
3829function sameSocialLinks ( a : Array < SocialMediaLink > , b : Array < SocialMediaLink > ) : boolean {
@@ -51,7 +42,7 @@ export default function useProfileSettings() {
5142
5243 const nameField = useTrackedField ( ( ) => profile . value ?. name ?? "" ) ;
5344 const bioField = useTrackedField ( ( ) => profile . value ?. bio ?? "" ) ;
54- const dobField = useTrackedField ( ( ) => toDate ( profile . value ?. dob ) , sameDay ) ;
45+ const dobField = useTrackedField ( ( ) => toDateString ( profile . value ?. dob ) ) ;
5546 const socialLinksField = useTrackedField (
5647 ( ) => ( Array . isArray ( profile . value ?. socialLinks ) ? profile . value ?. socialLinks : [ ] ) ,
5748 sameSocialLinks ,
0 commit comments