Sah/Schema/date/tz_offset_lax.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 10 / 10 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« Sah/Schema/date/second.pm ↑ Summary Sah/Schema/date/year.pm »
1 package Sah::Schema::date::tz_offset_lax;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
6 1 our $DATE = '2023-12-09'; # DATE
7 1 our $DIST = 'Sah-Schemas-Date'; # DIST
8 1 our $VERSION = '0.019'; # VERSION
9  
10 1 our $schema = ['date::tz_offset' => {
11 summary => 'Timezone offset in seconds from UTC (any offset is allowed, coercible from string), e.g. 1 or 25200 e.g. "UTC+7"',
12 'merge.delete.in' => [],
13 min => -12*3600,
14 max => +14*3600,
15 description => <<'_',
16  
17 This schema allows timezone offsets that are not known to exist, e.g. 1 second
18 (+00:00:01). If you only want ot allow timezone offsets that are known to exist,
19 see the `date::tz_offset` schema.
20  
21 A coercion from these form of string is provided:
22  
23 UTC
24  
25 UTC-14 or UTC+12 or UTC+12:45 or UTC-00:25:21
26 -14 or +12, -1400 or +12:00
27  
28 A coercion from timezone name is also provided.
29  
30 _
31 examples => [
32 {value=>'', valid=>0},
33 {value=>'UTC', valid=>1, validated_value=>0},
34 {value=>'3600', valid=>1, validated_value=>3600},
35 {value=>'-43200', valid=>1, validated_value=>-43200},
36 {value=>'-12', valid=>1, validated_value=>-12*3600},
37 {value=>'-1200', valid=>1, validated_value=>-12*3600},
38 {value=>'-12:00', valid=>1, validated_value=>-12*3600},
39 {value=>'UTC-12', valid=>1, validated_value=>-12*3600},
40 {value=>'UTC-1200', valid=>1, validated_value=>-12*3600},
41 {value=>'UTC+12:45', valid=>1, validated_value=>+12.75*3600},
42 {value=>'UTC-13', valid=>0},
43 {value=>'UTC+12:01', valid=>1, validated_value=>+(12*3600+60)},
44 ],
45 }];
46  
47 1 1;
48  
49 # ABSTRACT: Timezone offset in seconds from UTC (any offset is allowed, coercible from string), e.g. 1 or 25200 e.g. "UTC+7"
50  
51 __END__
« Sah/Schema/date/second.pm ↑ Summary Sah/Schema/date/year.pm »