fix: improve time format processing and add type validation

- Move sanitization after time format conversion to preserve HH:MM:SS detection
- Add validation for colon count and trim whitespace before format conversion
- Add type checking to validate_date() and validate_time() functions
- Explicitly cast inputs to string to prevent type-related errors

This prevents sanitization from interfering with time format detection
and ensures consistent handling of HTML5 time inputs with seconds.
