File tree 3 files changed +25
-3
lines changed
3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
1
Changes for DateTime::Set
2
2
3
+ dev 2020-10-10
4
+ - add set_locale(), following the DateTime API
5
+ Adjusted t/15time_zone.t and docs.
6
+
3
7
0.3900 2016-10-09
4
8
- require Params::Validate
5
9
Original file line number Diff line number Diff line change @@ -170,6 +170,17 @@ sub set_time_zone {
170
170
$self ;
171
171
}
172
172
173
+ sub set_locale {
174
+ my ($self , $locale ) = @_ ;
175
+ $self -> {set } = $self -> {set }-> iterate(
176
+ sub {
177
+ my $min = $_ [0]-> min;
178
+ $min -> clone-> set_locale( $locale ) if ref ($min );
179
+ },
180
+ );
181
+ $self ;
182
+ }
183
+
173
184
sub set {
174
185
my $self = shift ;
175
186
my %args = validate( @_ ,
@@ -901,10 +912,17 @@ method.
901
912
This method will attempt to apply the C<set_time_zone > method to every
902
913
datetime in the set.
903
914
904
- =item * set( locale => .. )
915
+ =item * set_locale( $locale )
916
+
917
+ This method will attempt to apply the C<set_locale > method to every
918
+ datetime in the set.
905
919
906
- This method can be used to change the C< locale > of a datetime set.
920
+ =item * set( minute => 0, second => 0 )
907
921
922
+ This method can be used to change the local components of a date time set. This
923
+ method accepts any parameter allowed by the C<< DateTime->new() >> method except for
924
+ "locale" or "time_zone". Use C<set_locale() > and C<set_time_zone() > for those
925
+ instead.
908
926
909
927
=item * start, min
910
928
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ is ( $months->clone->add( days => 1 )->
130
130
' default locale' );
131
131
132
132
is ( $months -> clone-> add( days => 1 )->
133
- set( locale => ' en_US' )->
133
+ set_locale( ' en_US' )->
134
134
next ( $t1 )->
135
135
strftime( " %a " ),
136
136
' Sun' ,
You can’t perform that action at this time.
0 commit comments