VgsExpiryDateFormat

sealed class VgsExpiryDateFormat

Card expiry date format used by com.verygoodsecurity.vgscollect.widget.compose.state.VgsExpiryTextFieldState.

Pick one for inputDateFormat (how the user types) and one for outputDateFormat (how the value is sent to VGS). They can differ — for example, accept MM/yy from the user but submit yyyy/MM.

Inheritors

Types

Link copied to clipboard

Four-digit year / two-digit month (e.g. 2027/12).

Link copied to clipboard

Two-digit month / four-digit year (e.g. 12/2027).

Link copied to clipboard

Two-digit month / two-digit year (e.g. 12/27).

Link copied to clipboard

Two-digit year / two-digit month (e.g. 27/12).

Properties

Link copied to clipboard

underlying SimpleDateFormat pattern.

Link copied to clipboard

input mask derived from dateFormat, where each digit is #.

Link copied to clipboard

Functions

Link copied to clipboard
fun convert(text: String, targetFormat: VgsExpiryDateFormat): String?

Reformats text from this format into targetFormat, or null when text cannot be parsed.

Link copied to clipboard
fun format(date: Date?): String?

Formats date using this format, returning null when date is null or invalid.

Link copied to clipboard
fun parse(text: String): Date?

Parses text using this format, returning null when text is invalid.