Expiry Date Validation Test: Check Card Expiry Inputs

Our Cards

Choose from any of our gift cards to give to your loved ones

more on this topic

giftcardimage

Where to Use?

Redeem your gift cards at any of our Merchants

expiry date test card

Where to Buy?

You can purchase a gift card from any of these locations

related article

ABOUT US

about

What is ONYX GiftCards?

Onyx Gift Cards is a Grenadian company designed to introduce, market and manage gift cards systems in Grenada for retailers and corporations. We are enthusiastic about the effect and influence we will have on the local market. We intend to expand our systems regionally with a range of product offerings and services.

What is a Gift Card?

Gift cards are the preferred way of giving and receiving gifts. They carry a monetary value that can be redeemed for gifts at your favorite store.
Onyx GiftCards are “Open Gift Cards” which means that they can be redeemed at multiple merchant locations. They are standard credit card size, can fit into the average wallet and made of PVC plastic. Onyx GiftCards are Barcoded for security and safety for the consumer and bear a disclaimer at the back.
Onyx Giftcards can be bought with a branded Card backer which is black in colour and is designed to fit the card. There is an area to write a brief message to the recipient as well.

How it Works?

  • Buy an Onyx Gift Card at these local stores
  • Give your gift card to friends, family, co-workers, etc.
  • The recipient can shop at our select merchants nationwide
  • Your friends, family, co-workers, etc. will present their gift card at checkout to pay for your item(s)
  • They will walk away happy with the best gift ever...the gift of Choice

Why ONYX GiftCards?

  • Save TIME. No need to run around looking for the perfect gift
  • Redeem from a variety of business island-wide. We will continue adding businesses as fast as ONYX grows.
  • ONYX Gift Cards do not expire
  • Cards are valued at convinient amounts to meet every need and occasion

An expiry date validation test checks that a payment form accepts card expiry dates written as MM/YY only when the month sits in the current month or later, and rejects past dates, malformed strings, and months outside 01 to 12. The test covers both the format rule and the date rule, because a form can pass one and fail the other. Teams run this suite before each release since a broken rule either blocks paying customers or stores junk data.

What rules does a card expiry check enforce?

Four rules cover almost every production case.

Format

The field holds two digits, a separator, then two more digits. A single-digit month such as 1/28 fails on most forms, so decide up front whether the code pads it or rejects it. Test typed input and pasted input, since the paste path often skips a keypress handler.

Month range

Months run from 01 to 12. Values like 00/28 and 13/28 must fail. The error message should name the field so the customer knows what to fix.

Lower bound

A card stays valid through the last second of its printed month. A card marked 06/26 works on June 30, 2026 and stops on July 1, 2026. This boundary causes most expiry bugs.

Upper bound

Some processors reject dates that sit too far out. A cap of 20 years catches typos such as 12/2125 while still accepting reissued cards.

Which edge cases belong in the test matrix?

How do you test the month boundary?

  1. Stub the system clock. Freeze the date at the first and last day of a month, then run the same suite.
  2. Run the suite on January 1 and December 31 to catch year rollover logic.
  3. Repeat with the client clock set to a different timezone than the server.
  4. Compare the browser result with the API result. They must match.

Time is the hard part. A tester who runs the suite mid-month never sees the off-by-one error.

Client-side and server-side checks

Browser validation gives fast feedback and cuts failed submissions. Server validation is the one that counts, since a script can skip the form. Run both and keep one rule set in each so they cannot drift apart.

What test data should you use?

Use sandbox card numbers issued by your payment processor, never live account data. Expiry dates in test files should be obviously fake, such as 01/30, and tied to a test BIN. Keep test card data out of production logs, since storing full card data brings PCI obligations.

What does a good expiry test case look like?

Each row needs four fields: the input string, the system date, the expected result, and the reason the case exists.

Store the system date with the row. A case that passes in March can fail in April, and a tester who forgets the date cannot reproduce the bug.

Which bugs show up again and again?

Where does expiry validation sit in the payment flow?

Expiry checks run at the form, again when the request reaches the server, and once more at the processor during authorization. A card with a dead expiry date comes back as response code 54, expired card. Logging that code helps support staff tell an expired card apart from a declined one.

FAQ

Should a card expire on the first day of the next month?

No. The card stays valid through the last day of the printed month.

Is a regex enough for expiry validation?

No. A regex handles format, but the future-date rule needs the current date from a trusted clock.

How many test rows do I need?

About 20 rows cover format, range, and boundary cases. Add one row per timezone you support.

Contact Us

Latest

Latest

Read our complete guide: Should You Buy CVV From a Card Shop? The Honest Buyer's Guide