Skip to content

Commit 94f5235

Browse files
committed
Add "timezone" as our preferred variant
* Fix all instances in the docs * Closes #4741
1 parent bb4981c commit 94f5235

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

doc/Language/faq.rakudoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ X<|Reference,v6.d (FAQ)>
4242
The v6.d Specification was released on
4343
L<Diwali 2018|https://en.wikipedia.org/wiki/Diwali>,
4444
which was November 6–7 2018, in a
45-
convenient time zone. 6.d was enabled by default in the Rakudo compiler
45+
convenient timezone. 6.d was enabled by default in the Rakudo compiler
4646
release of 2018.11.
4747

4848
The vast majority of 6.d features were already implemented and available

doc/Type/DateTime.rakudoc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
For handling points in civil time, a C<DateTime> object stores year, month,
1010
day, hour, minute (all L<C<Int>|/type/Int>), second (potentially fractional) and
11-
a time zone.
11+
a timezone.
1212

1313
It provides methods for calculating with date (for the Gregorian calendar) and time.
1414

1515
C<DateTime> methods are immutable; if you are tempted to modify one, create a
1616
modified copy instead.
1717

18-
Time zones are handled as L<C<Int>|/type/Int>s in B<seconds> offset from UTC,
19-
not by time zone name.
18+
Timezones are handled as L<C<Int>|/type/Int>s in B<seconds> offset from UTC,
19+
not by timezone name.
2020

2121
=begin code
2222
my $dt = DateTime.new(
@@ -61,7 +61,7 @@ Creates a new C<DateTime> object. One option for creating a new C<DateTime> obje
6161
is from the components (year, month, day, hour, ...) separately. Another is to
6262
pass a L<C<Date>|/type/Date> object for the date component, and specify the time
6363
component-wise. Yet another is to obtain the time from an
64-
L<C<Instant>|/type/Instant>, and only supply the time zone and formatter. Or
64+
L<C<Instant>|/type/Instant>, and only supply the timezone and formatter. Or
6565
instead of an L<C<Instant>|/type/Instant> you can supply a L<C<Numeric>|/type/Numeric> as a Unix timestamp
6666
(but note that this last method provides no way to disambiguate leap seconds,
6767
unlike using L<C<Instant>|/type/Instant>).
@@ -74,8 +74,8 @@ ISO 8601 standard, as we allow Unicode digits and mixing of condensed
7474
and extended time formats.
7575

7676
An invalid input string throws an exception of type
77-
L<C<X::Temporal::InvalidFormat>|/type/X::Temporal::InvalidFormat>. If you supply a string that includes a time
78-
zone and supply the C<timezone> named argument, an exception of type
77+
L<C<X::Temporal::InvalidFormat>|/type/X::Temporal::InvalidFormat>. If you supply a string that includes a
78+
timezone and supply the C<timezone> named argument, an exception of type
7979
L<C<X::DateTime::TimezoneClash>|/type/X::DateTime::TimezoneClash> is thrown.
8080

8181
my $datetime = DateTime.new(year => 2015,
@@ -91,7 +91,7 @@ L<C<X::DateTime::TimezoneClash>|/type/X::DateTime::TimezoneClash> is thrown.
9191
second => 1,
9292
timezone => 1);
9393
$datetime = DateTime.new(2015, 1, 1, # First January of 2015
94-
1, 1, 1); # Hour, minute, second with default time zone
94+
1, 1, 1); # Hour, minute, second with default timezone
9595
$datetime = DateTime.new(now); # Instant.
9696
# from a Unix timestamp
9797
say $datetime = DateTime.new(1470853583.3); # OUTPUT: «2016-08-10T18:26:23.300000Z␤»
@@ -185,15 +185,15 @@ Returns the second component, rounded down to an L<C<Int>|/type/Int>.
185185

186186
method timezone(DateTime:D: --> Int:D)
187187

188-
Returns the time zone B<in seconds> as an offset from UTC.
188+
Returns the timezone B<in seconds> as an offset from UTC.
189189

190190
say DateTime.new('2015-12-24T12:23:00+0200').timezone; # OUTPUT: «7200␤»
191191

192192
=head2 method offset
193193

194194
method offset(DateTime:D: --> Int:D)
195195

196-
Returns the time zone B<in seconds> as an offset from UTC. This is an alias for
196+
Returns the timezone B<in seconds> as an offset from UTC. This is an alias for
197197
L<method timezone|#method timezone>.
198198

199199
say DateTime.new('2015-12-24T12:23:00+0200').offset; # OUTPUT: «7200␤»
@@ -202,15 +202,15 @@ L<method timezone|#method timezone>.
202202

203203
method offset-in-minutes(DateTime:D: --> Real:D)
204204

205-
Returns the time zone in minutes as an offset from UTC.
205+
Returns the timezone in minutes as an offset from UTC.
206206

207207
say DateTime.new('2015-12-24T12:23:00+0200').offset-in-minutes; # OUTPUT: «120␤»
208208

209209
=head2 method offset-in-hours
210210

211211
method offset-in-hours(DateTime:D: --> Real:D)
212212

213-
Returns the time zone in hours as an offset from UTC.
213+
Returns the timezone in hours as an offset from UTC.
214214

215215
=for code
216216
say DateTime.new('2015-12-24T12:23:00+0200').offset-in-hours; # OUTPUT: «2␤»
@@ -323,7 +323,7 @@ Returns the date and time as a POSIX/Unix timestamp (non-leap seconds since the
323323
1970-01-01T00:00:00Z).
324324

325325
If C<$ignore-timezone> is C<True>, the C<DateTime> object will be treated as if
326-
the time zone offset is zero.
326+
the timezone offset is zero.
327327

328328
method posix(Bool:D: $ignore-timezone = False, :$real --> Num:D)
329329

@@ -386,7 +386,7 @@ Returns the invocant.
386386

387387
method utc(DateTime:D: --> DateTime:D)
388388

389-
Returns a DateTime object for the same time, but in time zone UTC.
389+
Returns a DateTime object for the same time, but in timezone UTC.
390390

391391
say DateTime.new('2015-12-24T12:23:00+0200').utc;
392392
# OUTPUT: «2015-12-24T10:23:00Z␤»
@@ -411,7 +411,7 @@ not respect local time and always occur at the end of the I<UTC> day:
411411

412412
method local(DateTime:D: --> DateTime:D)
413413

414-
Returns a DateTime object for the same time, but in the local time zone
414+
Returns a DateTime object for the same time, but in the local timezone
415415
(L«C<$*TZ>|/language/variables#index-entry-%24*TZ»).
416416

417417
my $*TZ = -3600;
@@ -425,7 +425,7 @@ Returns a DateTime object for the same time, but in the local time zone
425425
Takes a C<DateTime> to subtract from and either a
426426
L«C<Duration>|/type/Duration» or another C<DateTime> object. Returns a new
427427
C<DateTime> object or the L<C<Duration>|/type/Duration> between the two dates, respectively. When
428-
subtracting L<C<Duration>|/type/Duration>, time zone of the original C<DateTime> is preserved
428+
subtracting L<C<Duration>|/type/Duration>, timezone of the original C<DateTime> is preserved
429429
in the returned C<DateTime> object.
430430

431431
say raku DateTime.new(:2016year) - DateTime.new(:2015year):;
@@ -439,7 +439,7 @@ in the returned C<DateTime> object.
439439
multi infix:<+> (Duration:D, DateTime:D --> DateTime:D)
440440

441441
Takes a C<DateTime> and increases it by the given
442-
L«C<Duration>|/type/Duration», preserving the time zone.
442+
L«C<Duration>|/type/Duration», preserving the timezone.
443443

444444
say DateTime.new(:2015year) + Duration.new(31536001.0);
445445
# OUTPUT: «2016-01-01T00:00:00Z␤»

doc/Type/X/DateTime/TimezoneClash.rakudoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
=TITLE class X::DateTime::TimezoneClash
44

5-
=SUBTITLE Error due to using both time zone offset and :timezone
5+
=SUBTITLE Error due to using both timezone offset and :timezone
66

77
=for code :skip-test<compile time error>
88
class X::DateTime::TimezoneClash does X::Temporal is Exception { }
99

1010
This exception is thrown when code tries to create a L<C<DateTime>|/type/DateTime> object
11-
specifying both a time zone offset and the named argument C<:timezone>.
11+
specifying both a timezone offset and the named argument C<:timezone>.
1212

1313
=for code
1414
say DateTime.new('2015-12-24T12:23:00+0200'); # works

doc/Type/independent-routines.rakudoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,13 +1289,13 @@ say sleep-until $instant.Instant; # OUTPUT: «True␤» (eventually...)
12891289
This could be used as a primitive kind of alarm clock. For instance, say
12901290
you need to get up at 7am on the 4th of September 2015, but for some reason
12911291
your usual alarm clock is broken and you only have your laptop. You can
1292-
specify the time to get up (being careful about time zones, since
1292+
specify the time to get up (being careful about timezones, since
12931293
C<DateTime.new> uses UTC by default) as an L<C<Instant>|/type/Instant> and pass this to
12941294
C<sleep-until>, after which you can play an mp3 file to wake you up instead
12951295
of your normal alarm clock. This scenario looks roughly like this:
12961296

12971297
=for code
1298-
# DateTime.new uses UTC by default, so get time zone from current time
1298+
# DateTime.new uses UTC by default, so get timezone from current time
12991299
my $timezone = DateTime.now.timezone;
13001300
my $instant = DateTime.new(
13011301
year => 2015,

t/15-word-variants.rakutest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ my %variants = %(
4747
subdirectories => rx:i/ << sub [\s+|\-] directories /,
4848
subdirectory => rx:i/ << sub [\s+|\-] directory /,
4949
substring => rx:i/ << sub \- string /,
50+
timezone => rx:i/ << time [\s+|\-] zone /,
5051
titlecase => rx:i/ << title [\s+|\-] case /,
5152
uppercase => rx:i/ << upper [\s+|\-] case /,
5253
zero-width => rx:i/ << zero \s+ width<!before ' joiner'><!before ' no-break space'> /,

0 commit comments

Comments
 (0)