OCaml HTML5 parser/serialiser based on Python's JustHTML
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 43 lines 1.6 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved. 3 SPDX-License-Identifier: MIT 4 ---------------------------------------------------------------------------*) 5 6(** Datetime attribute validation checker. 7 8 This checker validates the [datetime] attribute on [<del>], [<ins>], 9 and [<time>] elements. The datetime value must conform to a valid 10 date, time, or datetime format as specified by HTML5. 11 12 {2 Supported Formats} 13 14 The checker validates these datetime formats: 15 - Date: [YYYY-MM-DD] (e.g., "2025-12-19") 16 - Month: [YYYY-MM] (e.g., "2025-12") 17 - Year: [YYYY] (e.g., "2025") 18 - Week: [YYYY-Www] (e.g., "2025-W51") 19 - Time: [HH:MM] or [HH:MM:SS] (e.g., "14:30:00") 20 - Datetime: Date followed by time with separator (e.g., "2025-12-19T14:30") 21 - Timezone offsets: [+HH:MM] or [-HH:MM] or [Z] 22 - Duration: [P] prefix followed by duration components 23 24 {2 Validation Rules} 25 26 - Month values must be 01-12 27 - Day values must be valid for the given month 28 - Leap years are correctly handled for February 29th 29 - Hour values must be 00-23 30 - Minute and second values must be 00-59 31 - Week numbers must be 01-53 32 33 {2 Error Messages} 34 35 Reports [Bad_value] when the datetime attribute contains an invalid 36 format or out-of-range values. 37 38 @see <https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#dates-and-times> 39 HTML Standard: Dates and times 40*) 41 42val checker : Checker.t 43(** The datetime attribute checker instance. *)