module TUI::Validation

Overview

Input validators for editable fields. Pure functions over strings — no widget state, no I/O.

Defined in:

tui/validation.cr

Constant Summary

TIME_FORMATS = ["%Y-%m-%d %H:%M:%S", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S.%L", "%Y-%m-%dT%H:%M:%S.%L", "%Y-%m-%d %H:%M:%S%z", "%Y-%m-%dT%H:%M:%S%z", "%Y-%m-%d %H:%M:%S.%L%z", "%Y-%m-%dT%H:%M:%S.%L%z", "%Y-%m-%d"]

Accepted time formats — ISO 8601 variants with optional T-separator, fractional seconds, and timezone offset, plus bare date.

Class Method Summary

Class Method Detail

def self.valid_decimal?(s : String) : Bool #

True if the input parses as an arbitrary-precision decimal.


[View source]
def self.valid_float?(s : String) : Bool #

True if the input parses as a 64-bit binary float.


[View source]
def self.valid_int?(s : String) : Bool #

True if the input parses as a 64-bit signed integer.


[View source]
def self.valid_time?(s : String) : Bool #

True if the input parses successfully under any accepted format.


[View source]