Skip to content

Commit bb93fa6

Browse files
authored
Add :date and :time functions (#570)
* Add :date and :time aliases * Define as standalone functions instead * Add hourCycle option to :time * Drop non-style options, use XML time & date validation rules
1 parent ff8417c commit bb93fa6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

spec/registry.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<validationRule id="anything" regex=".*"/>
1010
<validationRule id="anythingNotEmpty" regex=".+"/>
1111
<validationRule id="iso8601" regex="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}"/>
12+
<validationRule id="xmlDate"
13+
regex="-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"/>
14+
<validationRule id="xmlTime"
15+
regex="(([01][0-9]|2[0-3])(:[0-5][0-9]){2}(\.[0-9]+)?|24:00:00(\.0+)?)(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"/>
1216

1317
<function name="datetime">
1418
<!-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat -->
@@ -141,7 +145,36 @@
141145
</description>
142146
</option>
143147
</formatSignature>
148+
</function>
149+
150+
<function name="date">
151+
<description>
152+
Date formatting
153+
</description>
144154

155+
<formatSignature>
156+
<input validationRule="xmlDate"/>
157+
<option name="style" values="full long medium short">
158+
<description>
159+
The predefined date formatting style to use.
160+
</description>
161+
</option>
162+
</formatSignature>
163+
</function>
164+
165+
<function name="time">
166+
<description>
167+
Time formatting
168+
</description>
169+
170+
<formatSignature>
171+
<input validationRule="xmlTime"/>
172+
<option name="style" values="full long medium short">
173+
<description>
174+
The predefined time formatting style to use.
175+
</description>
176+
</option>
177+
</formatSignature>
145178
</function>
146179

147180
<function name="number">

0 commit comments

Comments
 (0)