Show
Ignore:
Timestamp:
11/19/08 11:19:30 (5 years ago)
Author:
daisuke
Message:

more stuff

Location:
lang/perl/DateTime-Lite/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/DateTime-Lite/trunk/lib/DateTime/Lite.pm

    r24215 r24216  
    66use DateTime::Lite::Util; 
    77use Scalar::Util qw(blessed); 
     8use SelfLoader; 
    89 
    910use constant INFINITY     =>      (9 ** 9 ** 9); 
     
    2930 
    3031# XXX Prime candidate for SelfLoading 
    31 sub ce_year {  
    32     my $year = $_[0]->{local_c}{year}; 
    33     return $year <= 0 ? $year - 1 : $year 
    34 } 
     32# XXX 
    3533 
    3634sub set_time_zone { 
     
    216214} 
    217215 
    218 # XXX FIXME 
    219 sub _offset_for_local_datetime { $_[0]->{tz}->offset_for_local_datetime( $_[0] ) } 
    220  
    221216sub _calc_local_rd 
    222217{ 
     
    239234 
    240235        # intentionally ignore leap seconds here 
    241         $self->_normalize_tai_seconds( $self->{local_rd_days}, $self->{local_rd_ 
    242 secs} ); 
     236        DateTime::Lite::Util::normalize_tai_seconds( $self->{local_rd_days}, $self->{local_rd_secs} ); 
    243237 
    244238        $self->{local_rd_secs} += $self->{offset_modifier}; 
     
    3123061; 
    313307 
     308__DATA__ 
     309sub millisecond { _round( $_[0]->{rd_nanosecs} / 1000000 ) } 
     310 
     311sub microsecond { _round( $_[0]->{rd_nanosecs} / 1000 ) } 
     312 
     313sub _round 
     314{ 
     315    my $val = shift; 
     316    my $int = int $val; 
     317 
     318    return $val - $int >= 0.5 ? $int + 1 : $int; 
     319} 
     320 
     321sub ce_year {  
     322    my $year = $_[0]->{local_c}{year}; 
     323    return $year <= 0 ? $year - 1 : $year 
     324} 
     325sub month_0 { $_[0]->{local_c}{month} - 1 } 
     326*mon_0 = \&month_0; 
     327 
     328sub era_name { $_[0]->{locale}->era_wide->[ $_[0]->_era_index() ] } 
     329 
     330sub era_abbr { $_[0]->{locale}->era_abbreviated->[ $_[0]->_era_index() ] } 
     331# deprecated 
     332*era = \&era_abbr; 
     333 
     334sub _era_index { $_[0]->{local_c}{year} <= 0 ? 0 : 1 } 
     335 
     336sub christian_era { $_[0]->ce_year > 0 ? 'AD' : 'BC' } 
     337sub secular_era   { $_[0]->ce_year > 0 ? 'CE' : 'BCE' } 
     338 
     339sub year_with_era { (abs $_[0]->ce_year) . $_[0]->era_abbr } 
     340sub year_with_christian_era { (abs $_[0]->ce_year) . $_[0]->christian_era } 
     341sub year_with_secular_era   { (abs $_[0]->ce_year) . $_[0]->secular_era } 
     342 
     343 
     344sub month_name { $_[0]->{locale}->month_format_wide->[ $_[0]->month_0() ] } 
     345 
     346sub month_abbr { $_[0]->{locale}->month_format_abbreviated->[ $_[0]->month_0() ] } 
     347 
     348*day_of_month = \&day; 
     349*mday = \&day; 
     350sub weekday_of_month { use integer; ( ( $_[0]->day - 1 ) / 7 ) + 1 } 
     351 
     352sub quarter_name { $_[0]->{locale}->quarter_format_wide->[ $_[0]->quarter_0() ] } 
     353sub quarter_abbr { $_[0]->{locale}->quarter_format_abbreviated->[ $_[0]->quarter_0() ] } 
     354 
     355sub quarter_0 { $_[0]->{local_c}{quarter} - 1 } 
     356 
     357sub day_of_month_0 { $_[0]->{local_c}{day} - 1 } 
     358*day_0  = \&day_of_month_0; 
     359*mday_0 = \&day_of_month_0; 
     360 
     361sub day_of_week { $_[0]->{local_c}{day_of_week} } 
     362*wday = \&day_of_week; 
     363*dow  = \&day_of_week; 
     364 
     365sub day_of_week_0 { $_[0]->{local_c}{day_of_week} - 1 } 
     366*wday_0 = \&day_of_week_0; 
     367*dow_0  = \&day_of_week_0; 
     368sub hour_1 { $_[0]->{local_c}{hour} == 0 ? 24 : $_[0]->{local_c}{hour} } 
     369 
     370sub hour_12   { my $h = $_[0]->hour % 12; return $h ? $h : 12 } 
     371sub hour_12_0 { $_[0]->hour % 12 } 
     372 
     373*min = \&minute; 
     374 
     375*sec = \&second; 
     376 
     377sub day_name { $_[0]->{locale}->day_format_wide->[ $_[0]->day_of_week_0() ] } 
     378 
     379sub day_abbr { $_[0]->{locale}->day_format_abbreviated->[ $_[0]->day_of_week_0() ] } 
     380 
     381sub day_of_quarter { $_[0]->{local_c}{day_of_quarter} } 
     382*doq = \&day_of_quarter; 
     383 
     384sub day_of_quarter_0 { $_[0]->day_of_quarter - 1 } 
     385*doq_0 = \&day_of_quarter_0; 
     386 
     387sub day_of_year { $_[0]->{local_c}{day_of_year} } 
     388*doy = \&day_of_year; 
     389 
     390sub day_of_year_0 { $_[0]->{local_c}{day_of_year} - 1 } 
     391*doy_0 = \&day_of_year_0; 
     392 
     393sub am_or_pm { $_[0]->{locale}->am_pm_abbreviated->[ $_[0]->hour() < 12 ? 0 : 1 ] } 
     394 
     395# ISO says that the first week of a year is the first week containing 
     396# a Thursday.  Extending that says that the first week of the month is 
     397# the first week containing a Thursday.  ICU agrees. 
     398# 
     399# Algorithm supplied by Rick Measham, who doesn't understand how it 
     400# works.  Neither do I.  Please feel free to explain this to me! 
     401sub week_of_month 
     402{ 
     403    my $self = shift; 
     404 
     405    # Faster than cloning just to get the dow 
     406    my $first_wday_of_month = ( 8 - ( $self->day - $self->dow ) % 7 ) % 7; 
     407    $first_wday_of_month = 7 unless $first_wday_of_month; 
     408 
     409    my $wom = int( ( $self->day + $first_wday_of_month - 2 ) / 7 ); 
     410    return ( $first_wday_of_month <= 4 ) ? $wom + 1 : $wom; 
     411} 
     412 
     413sub ymd 
     414{ 
     415    my ( $self, $sep ) = @_; 
     416    $sep = '-' unless defined $sep; 
     417 
     418    return sprintf( "%0.4d%s%0.2d%s%0.2d", 
     419                    $self->year, $sep, 
     420                    $self->{local_c}{month}, $sep, 
     421                    $self->{local_c}{day} ); 
     422} 
     423*date = \&ymd; 
     424 
     425sub mdy 
     426{ 
     427    my ( $self, $sep ) = @_; 
     428    $sep = '-' unless defined $sep; 
     429 
     430    return sprintf( "%0.2d%s%0.2d%s%0.4d", 
     431                    $self->{local_c}{month}, $sep, 
     432                    $self->{local_c}{day}, $sep, 
     433                    $self->year ); 
     434} 
     435 
     436sub dmy 
     437{ 
     438    my ( $self, $sep ) = @_; 
     439    $sep = '-' unless defined $sep; 
     440 
     441    return sprintf( "%0.2d%s%0.2d%s%0.4d", 
     442                    $self->{local_c}{day}, $sep, 
     443                    $self->{local_c}{month}, $sep, 
     444                    $self->year ); 
     445} 
     446 
     447sub hms 
     448{ 
     449    my ( $self, $sep ) = @_; 
     450    $sep = ':' unless defined $sep; 
     451 
     452    return sprintf( "%0.2d%s%0.2d%s%0.2d", 
     453                    $self->{local_c}{hour}, $sep, 
     454                    $self->{local_c}{minute}, $sep, 
     455                    $self->{local_c}{second} ); 
     456} 
     457# don't want to override CORE::time() 
     458*DateTime::Lite::time = \&hms; 
     459 
     460sub iso8601 { join 'T', $_[0]->ymd('-'), $_[0]->hms(':') } 
     461*datetime = \&iso8601; 
     462 
     463sub is_leap_year { DateTime::Lite::Util::is_leap_year( $_[0]->year ) } 
     464 
     465sub time_zone { $_[0]->{tz} } 
     466 
     467sub offset                     { $_[0]->{tz}->offset_for_datetime( $_[0] ) } 
     468sub _offset_for_local_datetime { $_[0]->{tz}->offset_for_local_datetime( $_[0] ) } 
     469 
     470sub is_dst { $_[0]->{tz}->is_dst_for_datetime( $_[0] ) } 
     471 
     472sub time_zone_long_name  { $_[0]->{tz}->name } 
     473sub time_zone_short_name { $_[0]->{tz}->short_name_for_datetime( $_[0] ) } 
     474 
     475sub locale { $_[0]->{locale} } 
     476*language = \&locale; 
     477 
     478 
     479 
    314480__END__ 
  • lang/perl/DateTime-Lite/trunk/lib/DateTime/Lite/Locale.pm

    r24134 r24216  
    2323} 
    2424 
    25 sub new { 
    26     my $class = shift; 
    27     bless { scalar @_ == 1 ? %{$_[0]} : @_ }, $class; 
    28 } 
    29  
    3025sub load { 
    3126    my ($class, $name) = @_; 
     
    3934} 
    4035 
     36use List::MoreUtils (); 
     37 
     38BEGIN 
     39{ 
     40    foreach my $field ( qw( id en_complete_name native_complete_name 
     41                            en_language en_script en_territory en_variant 
     42                            native_language native_script native_territory native_variant 
     43                          ) 
     44                      ) 
     45    { 
     46        # remove leading 'en_' for method name 
     47        (my $meth_name = $field) =~ s/^en_//; 
     48 
     49        # also remove 'complete_' 
     50        $meth_name =~ s/complete_//; 
     51 
     52        no strict 'refs'; 
     53        *{$meth_name} = sub { $_[0]->{$field} }; 
     54    } 
     55} 
     56 
     57sub new 
     58{ 
     59    my $class = shift; 
     60 
     61    # By making the default format lengths part of the object's hash 
     62    # key, it allows them to be settable. 
     63    return bless { @_, 
     64        default_date_format_length => $class->_default_date_format_length(), 
     65        default_time_format_length => $class->_default_time_format_length(), 
     66    }, $class; 
     67} 
     68 
     69sub language_id  { ( DateTime::Locale::_parse_id( $_[0]->id ) )[0] } 
     70sub script_id    { ( DateTime::Locale::_parse_id( $_[0]->id ) )[1] } 
     71sub territory_id { ( DateTime::Locale::_parse_id( $_[0]->id ) )[2] } 
     72sub variant_id   { ( DateTime::Locale::_parse_id( $_[0]->id ) )[3] } 
     73 
     74my @FormatLengths = qw( short medium long full ); 
     75 
     76sub date_format_default 
     77{ 
     78    my $meth = 'date_format_' . $_[0]->default_date_format_length(); 
     79    $_[0]->$meth(); 
     80} 
     81 
     82sub date_formats 
     83{ 
     84    return 
     85        { map { my $meth = 'date_format_' . $_; 
     86                $_ => $_[0]->$meth() } @FormatLengths } 
     87} 
     88 
     89sub time_format_default 
     90{ 
     91    my $meth = 'time_format_' . $_[0]->default_time_format_length(); 
     92    $_[0]->$meth(); 
     93} 
     94 
     95sub time_formats 
     96{ 
     97    return 
     98        { map { my $meth = 'time_format_' . $_; 
     99                $_ => $_[0]->$meth() } @FormatLengths } 
     100} 
     101 
     102sub format_for 
     103{ 
     104    my $self = shift; 
     105    my $for  = shift; 
     106 
     107    my $meth = '_format_for_' . $for; 
     108 
     109    return unless $self->can($meth); 
     110 
     111    return $self->$meth(); 
     112} 
     113 
     114sub available_formats 
     115{ 
     116    my $self = shift; 
     117 
     118    # The various parens seem to be necessary to force uniq() to see 
     119    # the caller's list context. Go figure. 
     120    my @uniq = List::MoreUtils::uniq( map { keys %{ $_->_available_formats() || {} } } 
     121                                      Class::ISA::self_and_super_path( ref $self ) ); 
     122 
     123    # Doing the sort in the same expression doesn't work under 5.6.x. 
     124    return sort @uniq; 
     125} 
     126 
     127# Just needed for the above method. 
     128sub _available_formats { } 
     129 
     130sub default_date_format_length { $_[0]->{default_date_format_length} } 
     131 
     132sub set_default_date_format_length 
     133{ 
     134    my $self = shift; 
     135    my ($l) = validate_pos( @_, { regex => qr/^(?:full|long|medium|short)$/i } ); 
     136 
     137    $self->{default_date_format_length} = lc $l; 
     138} 
     139 
     140sub default_time_format_length { $_[0]->{default_time_format_length} } 
     141 
     142sub set_default_time_format_length 
     143{ 
     144    my $self = shift; 
     145    my ($l) = validate_pos( @_, { regex => qr/^(?:full|long|medium|short)/i } ); 
     146 
     147    $self->{default_time_format_length} = lc $l; 
     148} 
     149 
     150for my $length ( qw( full long medium short ) ) 
     151{ 
     152    my $key = 'datetime_format_' . $length; 
     153 
     154    my $sub = 
     155        sub { my $self = shift; 
     156 
     157              return $self->{$key} if exists $self->{$key}; 
     158 
     159              my $date_meth = 'date_format_' . $length; 
     160              my $time_meth = 'time_format_' . $length; 
     161 
     162              return $self->{$key} = $self->_make_datetime_format( $date_meth, $time_meth ); 
     163            }; 
     164 
     165    no strict 'refs'; 
     166    *{$key} = $sub; 
     167} 
     168 
     169sub datetime_format_default 
     170{ 
     171    my $self = shift; 
     172 
     173    my $date_meth = 'date_format_' . $self->default_date_format_length(); 
     174    my $time_meth = 'time_format_' . $self->default_time_format_length(); 
     175 
     176    return $self->_make_datetime_format( $date_meth, $time_meth ); 
     177} 
     178 
     179sub _make_datetime_format 
     180{ 
     181    my $self      = shift; 
     182    my $date_meth = shift; 
     183    my $time_meth = shift; 
     184 
     185    my $dt_format = $self->datetime_format(); 
     186 
     187    my $time = $self->$time_meth(); 
     188    my $date = $self->$date_meth(); 
     189 
     190    $dt_format =~ s/\{0\}/$time/g; 
     191    $dt_format =~ s/\{1\}/$date/g; 
     192 
     193    return $dt_format; 
     194} 
     195 
     196sub prefers_24_hour_time 
     197{ 
     198    my $self = shift; 
     199 
     200    return $self->{prefers_24_hour_time} 
     201        if exists $self->{prefers_24_hour_time}; 
     202 
     203    $self->{prefers_24_hour_time} = 
     204        $self->time_format_short() =~ /h|K/ ? 0 : 1; 
     205} 
     206 
     207sub date_before_time 
     208{ 
     209    my $self = shift; 
     210 
     211    my $dt_format = $self->datetime_format(); 
     212 
     213    return $dt_format =~ /\{1\}.*\{0\}/ ? 1 : 0; 
     214} 
     215 
     216sub date_parts_order 
     217{ 
     218    my $self = shift; 
     219 
     220    my $short = $self->date_format_short(); 
     221 
     222    $short =~ tr{dmyDMY}{}cd; 
     223    $short =~ tr{dmyDMY}{dmydmy}s; 
     224 
     225    return $short; 
     226} 
     227 
     228sub full_date_format   { $_[0]->_convert_to_strftime( $_[0]->date_format_full() ) } 
     229sub long_date_format   { $_[0]->_convert_to_strftime( $_[0]->date_format_long() ) } 
     230sub medium_date_format { $_[0]->_convert_to_strftime( $_[0]->date_format_medium() ) } 
     231sub short_date_format  { $_[0]->_convert_to_strftime( $_[0]->date_format_short() ) } 
     232sub default_date_format { $_[0]->_convert_to_strftime( $_[0]->date_format_default() ) } 
     233 
     234sub full_time_format   { $_[0]->_convert_to_strftime( $_[0]->time_format_full() ) } 
     235sub long_time_format   { $_[0]->_convert_to_strftime( $_[0]->time_format_long() ) } 
     236sub medium_time_format { $_[0]->_convert_to_strftime( $_[0]->time_format_medium() ) } 
     237sub short_time_format  { $_[0]->_convert_to_strftime( $_[0]->time_format_short() ) } 
     238sub default_time_format { $_[0]->_convert_to_strftime( $_[0]->time_format_default() ) } 
     239 
     240sub full_datetime_format   { $_[0]->_convert_to_strftime( $_[0]->datetime_format_full() ) } 
     241sub long_datetime_format   { $_[0]->_convert_to_strftime( $_[0]->datetime_format_long() ) } 
     242sub medium_datetime_format { $_[0]->_convert_to_strftime( $_[0]->datetime_format_medium() ) } 
     243sub short_datetime_format  { $_[0]->_convert_to_strftime( $_[0]->datetime_format_short() ) } 
     244sub default_datetime_format { $_[0]->_convert_to_strftime( $_[0]->datetime_format_default() ) } 
     245 
     246# Older versions of DateTime.pm will not pass in the $cldr_ok flag, so 
     247# we will give them the converted-to-strftime pattern (bugs and all). 
     248sub _convert_to_strftime 
     249{ 
     250    my $self    = shift; 
     251    my $pattern = shift; 
     252    my $cldr_ok = shift; 
     253 
     254    return $pattern if $cldr_ok; 
     255 
     256    return $self->{_converted_patterns}{$pattern} 
     257        if exists $self->{_converted_patterns}{$pattern}; 
     258 
     259    return $self->{_converted_patterns}{$pattern} = $self->_cldr_to_strftime($pattern); 
     260} 
     261 
     262{ 
     263    my @JavaPatterns = 
     264        ( qr/G/     => '{era}', 
     265          qr/yyyy/  => '{ce_year}', 
     266          qr/y/     => 'y', 
     267          qr/u/     => 'Y', 
     268          qr/MMMM/  => 'B', 
     269          qr/MMM/   => 'b', 
     270          qr/MM/    => 'm', 
     271          qr/M/     => '{month}', 
     272          qr/dd/    => 'd', 
     273          qr/d/     => '{day}', 
     274          qr/hh/    => 'l', 
     275          qr/h/     => '{hour_12}', 
     276          qr/HH/    => 'H', 
     277          qr/H/     => '{hour}', 
     278          qr/mm/    => 'M', 
     279          qr/m/     => '{minute}', 
     280          qr/ss/    => 'S', 
     281          qr/s/     => '{second}', 
     282          qr/S/     => 'N', 
     283          qr/EEEE/  => 'A', 
     284          qr/E/     => 'a', 
     285          qr/D/     => 'j', 
     286          qr/F/     => '{weekday_of_month}', 
     287          qr/w/     => 'V', 
     288          qr/W/     => '{week_month}', 
     289          qr/a/     => 'p', 
     290          qr/k/     => '{hour_1}', 
     291          qr/K/     => '{hour_12_0}', 
     292          qr/z/     => '{time_zone_long_name}', 
     293        ); 
     294 
     295    sub _cldr_to_strftime 
     296    { 
     297        shift; 
     298        my $simple = shift; 
     299 
     300        $simple =~ 
     301            s/(G+|y+|u+|M+|d+|h+|H+|m+|s+|S+|E+|D+|F+|w+|W+|a+|k+|K+|z+)|'((?:[^']|'')*)'/ 
     302                $2 ? _stringify($2) : $1 ? _convert($1) : "'"/eg; 
     303 
     304        return $simple; 
     305    } 
     306 
     307    sub _convert 
     308    { 
     309        my $simple = shift; 
     310 
     311        for ( my $x = 0; $x < @JavaPatterns; $x += 2 ) 
     312        { 
     313            return '%' . $JavaPatterns[ $x + 1 ] if $simple =~ /$JavaPatterns[$x]/; 
     314        } 
     315 
     316        die "**Dont know $simple***"; 
     317    } 
     318 
     319    sub _stringify 
     320    { 
     321        my $string = shift; 
     322 
     323        $string =~ s/%(?:[^%])/%%/g; 
     324        $string =~ s/\'\'/\'/g; 
     325 
     326        return $string; 
     327    } 
     328} 
     329 
     330# end backwards compat 
     331 
     332sub STORABLE_freeze 
     333{ 
     334    my $self = shift; 
     335    my $cloning = shift; 
     336 
     337    return if $cloning; 
     338 
     339    return $self->id(); 
     340} 
     341 
     342sub STORABLE_thaw 
     343{ 
     344    my $self = shift; 
     345    my $cloning = shift; 
     346    my $serialized = shift; 
     347 
     348    my $obj = DateTime::Locale->load( $serialized ); 
     349 
     350    %$self = %$obj; 
     351 
     352    return $self; 
     353} 
     354 
     355foreach my $field qw( 
     356am_pm_abbreviated 
     357date_format_full 
     358date_format_long 
     359date_format_medium 
     360date_format_short 
     361datetime_format 
     362day_format_abbreviated 
     363day_format_narrow 
     364day_format_wide 
     365day_stand_alone_abbreviated 
     366day_stand_alone_narrow 
     367day_stand_alone_wide 
     368era_abbreviated 
     369era_narrow 
     370era_wide 
     371first_day_of_week 
     372month_format_abbreviated 
     373month_format_narrow 
     374month_format_wide 
     375month_stand_alone_abbreviated 
     376month_stand_alone_narrow 
     377month_stand_alone_wide 
     378quarter_format_abbreviated 
     379quarter_format_narrow 
     380quarter_format_wide 
     381quarter_stand_alone_abbreviated 
     382quarter_stand_alone_narrow 
     383quarter_stand_alone_wide 
     384time_format_full 
     385time_format_long 
     386time_format_medium 
     387time_format_short 
     388_default_date_format_length 
     389_default_time_format_length 
     390_format_for_Hm 
     391_format_for_M 
     392_format_for_MEd 
     393_format_for_MMM 
     394_format_for_MMMEd 
     395_format_for_MMMMEd 
     396_format_for_MMMMd 
     397_format_for_MMMd 
     398_format_for_Md 
     399_format_for_d 
     400_format_for_ms 
     401_format_for_y 
     402_format_for_yM 
     403_format_for_yMEd 
     404_format_for_yMMM 
     405_format_for_yMMMEd 
     406_format_for_yMMMM 
     407_format_for_yQ 
     408_format_for_yQQQ 
     409) { 
     410    no strict 'refs'; 
     411    *{$field} = sub { $_[0]->{$field} } 
     412} 
     413 
     414 
    414151; 
  • lang/perl/DateTime-Lite/trunk/misc/locale/en_US.yaml

    r24134 r24216  
    11name: en_US 
     2am_pm_abbreviated: [ "AM", "PM" ] 
     3date_format_full: "EEEE, MMMM d, yyyy" 
     4date_format_long: "MMMM d, yyyy" 
     5date_format_medium: "MMM d, yyyy" 
     6date_format_short: "M/d/yy" 
     7datetime_format: "{1} {0}" 
     8day_format_abbreviated: [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ] 
     9day_format_narrow: [ "M", "T", "W", "T", "F", "S", "S" ] 
     10day_format_wide: [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] 
     11 
     12day_stand_alone_abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] 
     13day_stand_alone_narrow: [ "M", "T", "W", "T", "F", "S", "S" ] 
     14 
     15day_stand_alone_wide: [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] 
     16era_abbreviated: [ "BC", "AD" ] 
     17era_narrow: [ "B", "A" ] 
     18era_wide: [ "Before Christ", "Anno Domini" ] 
     19first_day_of_week: 1 
     20month_format_abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] 
     21 
     22month_format_narrow: [ "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" ] 
     23month_format_wide: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] 
     24month_stand_alone_abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] 
     25month_stand_alone_narrow: [ "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" ] 
     26 
     27month_stand_alone_wide: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] 
     28quarter_format_abbreviated: [ "Q1", "Q2", "Q3", "Q4" ] 
     29quarter_format_narrow: [ "1", "2", "3", "4" ] 
     30quarter_format_wide: [ "1st quarter", "2nd quarter", "3rd quarter", "4th quarter" ] 
     31 
     32quarter_stand_alone_abbreviated : [ "Q1", "Q2", "Q3", "Q4" ] 
     33quarter_stand_alone_narrow: [ "1", "2", "3", "4" ] 
     34 
     35quarter_stand_alone_wide : [ "1st quarter", "2nd quarter", "3rd quarter", "4th quarter" ] 
     36time_format_full: "h:mm:ss a v" 
     37time_format_long: "h:mm:ss a z" 
     38time_format_medium: "h:mm:ss a" 
     39time_format_short: "h:mm a" 
     40_format_for_Hm: "HH:mm" 
     41_format_for_Hms: "HH:mm:ss" 
     42_format_for_M: "L" 
     43_format_for_MEd: "E, M/d" 
     44_format_for_MMM: "LLL" 
     45_format_for_MMMEd: "E, MMM d" 
     46_format_for_MMMMEd: "E, MMMM d" 
     47_format_for_MMMMd: "MMMM d" 
     48_format_for_MMMd: "MMM d" 
     49_format_for_Md: "M/d" 
     50_format_for_d: "d" 
     51_format_for_hm: "h:mm a" 
     52_format_for_ms: "mm:ss" 
     53_format_for_y: "yyyy" 
     54_format_for_yM: "M/yyyy" 
     55_format_for_yMEd: "EEE, M/d/yyyy" 
     56_format_for_yMMM: "MMM yyyy" 
     57_format_for_yMMMEd: "EEE, MMM d, yyyy" 
     58_format_for_yMMMM: "MMMM yyyy" 
     59_format_for_yQ: "Q yyyy" 
     60_format_for_yQQQ: "QQQ yyyy" 
     61_available_formats: 
     62    "Hm": "HH:mm" 
     63    "Hms": "HH:mm:ss" 
     64    "M": "L" 
     65    "MEd": "E, M/d" 
     66    "MMM": "LLL" 
     67    "MMMEd": "E, MMM d" 
     68    "MMMMEd": "E, MMMM d" 
     69    "MMMMd": "MMMM d" 
     70    "MMMd": "MMM d" 
     71    "Md": "M/d" 
     72    "d": "d" 
     73    "hm": "h:mm a" 
     74    "ms": "mm:ss" 
     75    "y": "yyyy" 
     76    "yM": "M/yyyy" 
     77    "yMEd": "EEE, M/d/yyyy" 
     78    "yMMM": "MMM yyyy" 
     79    "yMMMEd": "EEE, MMM d, yyyy" 
     80    "yMMMM": "MMMM yyyy" 
     81    "yQ": "Q yyyy" 
     82    "yQQQ": "QQQ yyyy" 
     83 
  • lang/perl/DateTime-Lite/trunk/t/03components.t

    r24134 r24216  
    143143    is( $dt0->year_with_secular_era, '1CE', 'year_with_secular_era is 1CE' ); 
    144144 
     145    SKIP: {  
     146        skip "arithmetic not yet implemented", 8; 
     147 
    145148    $dt0->subtract( years => 1 ); 
    146149 
     
    153156    is( $dt0->secular_era, 'BCE', 'secular_era is BCE' ); 
    154157    is( $dt0->year_with_secular_era, '1BCE', 'year_with_secular_era is 1BCE' ); 
     158    } 
    155159} 
    156160 
     
    160164    is( $dt_neg->ce_year, -11, "year -10 is ce_year -11" ); 
    161165 
     166    SKIP: { 
     167        skip "duration not yet implemented", 2; 
    162168    my $dt1 = $dt_neg + DateTime::Lite::Duration->new( years => 10 ); 
    163169    is( $dt1->year, 0, "year is 0 after adding ten years to year -10" ); 
    164170    is( $dt1->ce_year, -1, "ce_year is -1 after adding ten years to year -10" ); 
     171    } 
    165172} 
    166173