set up the basic structure
9 fils de conversation non résolus
9 fils de conversation non résolus
Closes VSN-78
Rapports de requête de fusion
Activité
Filtrer l'activité
assigned to @oussama.toumi
@oussama.toumi please fix the build issues
39 useMemo(() => handleScrollChange, [handleScrollChange]) 40 ); 41 42 const memoizedValue = useMemo(() => ({ elementRef, offsetTop }), [offsetTop]); 43 44 return memoizedValue; 45 } 46 47 /* 48 * 1: Applies to top <header/> 49 * const { offsetTop } = useScrollOffSetTop(80); 50 * 51 * Or 52 * 53 * 2: Applies to element 54 * const { offsetTop, elementRef } = useScrollOffSetTop(80); 34 ); 35 36 useMotionValueEvent( 37 scrollY, 38 'change', 39 useMemo(() => handleScrollChange, [handleScrollChange]) 40 ); 41 42 const memoizedValue = useMemo(() => ({ elementRef, offsetTop }), [offsetTop]); 43 44 return memoizedValue; 45 } 46 47 /* 48 * 1: Applies to top <header/> 49 * const { offsetTop } = useScrollOffSetTop(80); 82 */ 83 export function fTimestamp(date: DatePickerFormat) { 84 if (!date) { 85 return null; 86 } 87 88 const isValid = dayjs(date).isValid(); 89 90 return isValid ? dayjs(date).valueOf() : 'Invalid time value'; 91 } 92 93 // ---------------------------------------------------------------------- 94 95 /** output: a few seconds, 2 years 96 */ 97 export function fToNow(date: DatePickerFormat) { 96 */ 97 export function fToNow(date: DatePickerFormat) { 98 if (!date) { 99 return null; 100 } 101 102 const isValid = dayjs(date).isValid(); 103 104 return isValid ? dayjs(date).toNow(true) : 'Invalid time value'; 105 } 106 107 // ---------------------------------------------------------------------- 108 109 /** output: boolean 110 */ 111 export function fIsBetween( 140 141 /** output: boolean 142 */ 143 export function fIsSame( 144 startDate: DatePickerFormat, 145 endDate: DatePickerFormat, 146 units?: OpUnitType 147 ) { 148 if (!startDate || !endDate) { 149 return false; 150 } 151 152 const isValid = dayjs(startDate).isValid() && dayjs(endDate).isValid(); 153 154 if (!isValid) { 155 return 'Invalid time value'; 128 return false; 129 } 130 131 // ---------------------------------------------------------------------- 132 133 /** output: boolean 134 */ 135 export function fIsAfter(startDate: DatePickerFormat, endDate: DatePickerFormat) { 136 return dayjs(startDate).isAfter(endDate); 137 } 138 139 // ---------------------------------------------------------------------- 140 141 /** output: boolean 142 */ 143 export function fIsSame( 164 * Same day: 26 Apr 2024 165 * Same month: 25 - 26 Apr 2024 166 * Same month: 25 - 26 Apr 2024 167 * Same year: 25 Apr - 26 May 2024 168 */ 169 export function fDateRangeShortLabel( 170 startDate: DatePickerFormat, 171 endDate: DatePickerFormat, 172 initial?: boolean 173 ) { 174 const isValid = dayjs(startDate).isValid() && dayjs(endDate).isValid(); 175 176 const isAfter = fIsAfter(startDate, endDate); 177 178 if (!isValid || isAfter) { 179 return 'Invalid time value';
Veuillez vous inscrire ou vous connecter pour répondre