Skip to content

Commit fa33e0e

Browse files
committed
add comment to explain expiration date formatting
1 parent 8c8f4bb commit fa33e0e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/components/AddPaymentCard/PaymentCardForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ function PaymentCardForm({
144144

145145
const previousValueRef = useRef<string>('');
146146

147+
// Formats user input into a valid expiration date (MM/YY) and automatically adds slash after the month.
148+
// Ensures the month is always between 01 and 12 by correcting invalid value to match the proper format.
147149
const onChangeExpirationDate = useCallback((newValue: string) => {
148150
if (typeof newValue !== 'string') {
149151
return;

0 commit comments

Comments
 (0)