Documentation / @blazetrails/activesupport / TimeZone
Class: TimeZone
Defined in: packages/activesupport/lib/values/time-zone.ts:355
Constructors
Constructor
new TimeZone(
name,utcOffset?,tzinfo?):TimeZone
Defined in: packages/activesupport/lib/values/time-zone.ts:364
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
utcOffset | number | null | null |
tzinfo | Timezone | null | null |
Returns
TimeZone
Invented Arm
if — PERMANENT
Invented Arm
create — PERMANENT
Properties
equals
equals: (
this,other) =>boolean=cmpEquals
Defined in: packages/activesupport/lib/values/time-zone.ts:530
Ruby Comparable#== (vendor/ruby/v3.3.11/compar.c:79 cmp_equal), the one derived operator that does NOT raise: a nil <=> is false, and an identical object is true before <=> is sent at all.
Parameters
| Parameter | Type |
|---|---|
this | Comparable |
other | unknown |
Returns
boolean
No Rails Equivalent
PERMANENT — Ruby core Comparable cmp_equal (vendor/ruby/v3.3.11/compar.c:79).
name
readonlyname:string
Defined in: packages/activesupport/lib/values/time-zone.ts:356
tzinfo
readonlytzinfo:Timezone
Defined in: packages/activesupport/lib/values/time-zone.ts:357
Accessors
utcOffset
Get Signature
get utcOffset():
number
Defined in: packages/activesupport/lib/values/time-zone.ts:511
Returns
number
Methods
abbr()
abbr(
time):string
Defined in: packages/activesupport/lib/values/time-zone.ts:555
Parameters
| Parameter | Type |
|---|---|
time | Time |
Returns
string
at()
at(
seconds,microsecondsWithFrac?):TimeWithZone
Defined in: packages/activesupport/lib/values/time-zone.ts:501
at(*args) (time_zone.rb:378-380): Time.at(*args).utc.in_time_zone(self).
Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00 Time.at(946684800, 123456.789).nsec # => 123456789
getutc is Ruby's Time#utc on an immutable receiver (trails' ::Time has no in-place conversion), and toTime().toInstant() is the instant a TimeWithZone holds where Ruby's in_time_zone takes the ::Time itself.
Parameters
| Parameter | Type | Default value |
|---|---|---|
seconds | number | bigint | Rational | undefined |
microsecondsWithFrac | number | bigint | Rational | 0 |
Returns
Missing Rails Call
in_time_zone — PERMANENT: Time.at(*args).utc.in_time_zone(self) (time_zone.rb:379-381) round-trips through the Time core-ext to land in self; trails builds the TimeWithZone directly from the epoch instant, and in_time_zone's own TimeZone arm is that same constructor call (core-ext/date-and-time/zones.ts timeWithZone). Routing through it would close a values/time-zone -> zones -> values/time-zone module cycle (zones.ts:17 imports TimeZone from this file, and timeWithZone is not exported), which ESM cannot express — for no behavioural difference.
Missing Rails Call
utc — PERMANENT. Time.at(*args).utc (time_zone.rb:379-381). trails' at reaches the same instant through Time#getutc (packages/date time.ts:783) — ruby/time's own utc/getutc pair — because the ported Time is immutable and carries no in-place utc. Pre-existing: surfaced only once DateTime#utc (date_time/calculations.rb:184) was ported and utc entered the population.
compareTo()
compareTo(
zone):number|undefined
Defined in: packages/activesupport/lib/values/time-zone.ts:520
Parameters
| Parameter | Type |
|---|---|
zone | unknown |
Returns
number | undefined
encodeWith()
encodeWith(
coder):void
Defined in: packages/activesupport/lib/values/time-zone.ts:568
Parameters
| Parameter | Type |
|---|---|
coder | Coder |
Returns
void
formattedOffset()
formattedOffset(
colon?,alternateUtcString?):string
Defined in: packages/activesupport/lib/values/time-zone.ts:515
Parameters
| Parameter | Type | Default value |
|---|---|---|
colon | boolean | true |
alternateUtcString | string | null | null |
Returns
string
initWith()
initWith(
coder):void
Defined in: packages/activesupport/lib/values/time-zone.ts:564
Parameters
| Parameter | Type |
|---|---|
coder | Coder |
Returns
void
Invented Arm
assign — PERMANENT
inspect()
inspect():
string
Defined in: packages/activesupport/lib/values/time-zone.ts:758
Returns
string
isDst()
isDst(
time):boolean
Defined in: packages/activesupport/lib/values/time-zone.ts:559
Parameters
| Parameter | Type |
|---|---|
time | Time |
Returns
boolean
isMatch()
isMatch(
re):boolean
Defined in: packages/activesupport/lib/values/time-zone.ts:649
Parameters
| Parameter | Type |
|---|---|
re | string | RegExp |
Returns
boolean
iso8601()
iso8601(
str):TimeWithZone
Defined in: packages/activesupport/lib/values/time-zone.ts:585
Parameters
| Parameter | Type |
|---|---|
str | string | null | undefined |
Returns
local()
local(
year,month?,day?,hour?,minute?,second?,millisecond?):TimeWithZone
Defined in: packages/activesupport/lib/values/time-zone.ts:438
Parameters
| Parameter | Type | Default value |
|---|---|---|
year | number | undefined |
month | number | 1 |
day | number | 1 |
hour | number | 0 |
minute | number | 0 |
second | number | 0 |
millisecond | number | 0 |
Returns
localToUtc()
localToUtc(
time,dst?):Time
Defined in: packages/activesupport/lib/values/time-zone.ts:539
Parameters
| Parameter | Type | Default value |
|---|---|---|
time | Time | undefined |
dst | boolean | null | true |
Returns
Time
now()
now():
TimeWithZone
Defined in: packages/activesupport/lib/values/time-zone.ts:434
Returns
parse()
parse(
str,now?):TimeWithZone|undefined
Defined in: packages/activesupport/lib/values/time-zone.ts:468
Parameters
| Parameter | Type |
|---|---|
str | string |
now | TimeWithZone |
Returns
TimeWithZone | undefined
periodForLocal()
periodForLocal(
time,dst?):TimezonePeriod
Defined in: packages/activesupport/lib/values/time-zone.ts:547
Parameters
| Parameter | Type | Default value |
|---|---|---|
time | Time | DateTime | undefined |
dst | boolean | null | true |
Returns
TimezonePeriod
periodForUtc()
periodForUtc(
time):TimezonePeriod
Defined in: packages/activesupport/lib/values/time-zone.ts:543
Parameters
| Parameter | Type |
|---|---|
time | Time |
Returns
TimezonePeriod
periodsForLocal()
periodsForLocal(
time):TimezonePeriod[]
Defined in: packages/activesupport/lib/values/time-zone.ts:551
Parameters
| Parameter | Type |
|---|---|
time | Time | DateTime |
Returns
TimezonePeriod[]
rfc3339()
rfc3339(
str):TimeWithZone
Defined in: packages/activesupport/lib/values/time-zone.ts:629
Parameters
| Parameter | Type |
|---|---|
str | string |
Returns
strptime()
strptime(
str,format,now?):TimeWithZone|undefined
Defined in: packages/activesupport/lib/values/time-zone.ts:472
Parameters
| Parameter | Type |
|---|---|
str | string |
format | string |
now | TimeWithZone |
Returns
TimeWithZone | undefined
today()
today():
PlainDate
Defined in: packages/activesupport/lib/values/time-zone.ts:573
Returns
PlainDate
tomorrow()
tomorrow():
PlainDate
Defined in: packages/activesupport/lib/values/time-zone.ts:577
Returns
PlainDate
toString()
toString():
string
Defined in: packages/activesupport/lib/values/time-zone.ts:754
Returns
string
utcToLocal()
utcToLocal(
time):Time
Defined in: packages/activesupport/lib/values/time-zone.ts:532
Parameters
| Parameter | Type |
|---|---|
time | Time |
Returns
Time
yesterday()
yesterday():
PlainDate
Defined in: packages/activesupport/lib/values/time-zone.ts:581
Returns
PlainDate
all()
staticall():TimeZone[]
Defined in: packages/activesupport/lib/values/time-zone.ts:429
Returns
TimeZone[]
clear()
staticclear():void
Defined in: packages/activesupport/lib/values/time-zone.ts:672
Returns
void
countryZones()
staticcountryZones(countryCode):TimeZone[]
Defined in: packages/activesupport/lib/values/time-zone.ts:662
Parameters
| Parameter | Type |
|---|---|
countryCode | string |
Returns
TimeZone[]
create()
staticcreate<T>(this,name,utcOffset?,tzinfo?):InstanceType<T>
Defined in: packages/activesupport/lib/values/time-zone.ts:415
Type Parameters
| Type Parameter |
|---|
T extends typeof TimeZone |
Parameters
| Parameter | Type | Default value |
|---|---|---|
this | T | undefined |
name | string | undefined |
utcOffset | number | null | null |
tzinfo | Timezone | null | null |
Returns
InstanceType<T>
find()
staticfind(arg):TimeZone|null
Defined in: packages/activesupport/lib/values/time-zone.ts:380
Parameters
| Parameter | Type |
|---|---|
arg | unknown |
Returns
TimeZone | null
findTzinfo()
staticfindTzinfo(name):Timezone
Defined in: packages/activesupport/lib/values/time-zone.ts:412
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Timezone
secondsToUtcOffset()
staticsecondsToUtcOffset(seconds,colon?):string
Defined in: packages/activesupport/lib/values/time-zone.ts:372
Parameters
| Parameter | Type | Default value |
|---|---|---|
seconds | number | undefined |
colon | boolean | true |
Returns
string
usZones()
staticusZones():TimeZone[]
Defined in: packages/activesupport/lib/values/time-zone.ts:658
Returns
TimeZone[]