MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

validity

MMO.core · 5 symboles · générée le 27 Oct 2026

namespace

validity

validity.js:13

The messages of the browser's own checks (required, min, max, pattern...) speak the browser's language, not the application's ("Value must be 10/19/2026 03:08 PM or earlier." in a French page), and a date bound comes in the browser's format. These say the same in the page's language, the bounds of a date in its own format.

MMO.core.validity = {…}
Espace de noms
MMO.core
Voir
mmo-validity, which shows them under its controls

Constantes1

DATE_TYPES

validity.js:15

the input types whose bounds are dates, and how a bound of each is written

DATE_TYPES = {date: 'date', 'datetime-local': 'datetime', time: 'time'}
function

isMissing

validity.js:25

Whether a control's value is none, for required (valueMissing): no value, an empty text, an empty list. What a custom element that holds any value checks (<mmo-select>): the empty text of a search is no choice (#264).

function MMO.core.validity.isMissing(value)
Espace de noms
MMO.core.validity
value*
retournebooleanfalse for 0 and false, which are values
MMO.core.validity.isMissing(''); // true
function

formatBound

validity.js:40

Write a bound (min, max) of a control for the user: a date in the page's format, a number grouped.

function MMO.core.validity.formatBound(value, type, lang = null)
Espace de noms
MMO.core.validity
valuestringthe attribute's value ('2026-10-16', '2026-10-16T15:08', '15:08', '12')
typestringthe input's type
lang = null?stringthe locale, the page's by default
retournestringthe value itself when it cannot be read
MMO.core.validity.formatBound('2026-10-16T15:08', 'datetime-local'); // '16/10/2026 à 15:08' in French
function

message

validity.js:71

The message of the first check a control fails, in the page's language.

function MMO.core.validity.message(element, lang = null)
Espace de noms
MMO.core.validity
A message the page set itself (`setCustomValidity`) is kept as it is; a control that is not a native one (a custom element) says its own.
elementElementan input, a select, a textarea, or anything with validity and validationMessage
lang = null?stringthe locale, the page's by default
retournestringan empty string when the control is valid
MMO.core.validity.message(input); // 'La date doit être au plus tard le 19/10/2026 à 15:08'
function

compareBounds

validity.js:147

Compare two bounds of the same control.

function MMO.core.validity.compareBounds(a, b, type)
Espace de noms
MMO.core.validity
astring
bstring
typestringthe input's type
retournenumber-1, 0 or 1; 0 when either cannot be read