[DOC] Fix Time#localtime return value (#17928)

This commit is contained in:
Ajay Krishnan 2026-07-26 08:13:17 -07:00 committed by GitHub
parent 5968753774
commit f10a97dba9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2026-07-26 15:13:45 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>

11
time.c
View File

@ -4163,20 +4163,19 @@ time_zonelocal(VALUE time, VALUE off)
/*
* call-seq:
* localtime -> self or new_time
* localtime(zone) -> new_time
* localtime -> self
* localtime(zone) -> self
*
* With no argument given:
*
* - Returns +self+ if +self+ is a local time.
* - Otherwise returns a new +Time+ in the user's local timezone:
* - Returns +self+ if +self+ is already a local time.
* - Otherwise returns +self+, converted to the user's local timezone:
*
* t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
* t.localtime # => 2000-01-01 14:15:01 -0600
*
* With argument +zone+ given,
* returns the new +Time+ object created by converting
* +self+ to the given time zone:
* returns +self+, converted to the given time zone:
*
* t = Time.utc(2000, 1, 1, 20, 15, 1) # => 2000-01-01 20:15:01 UTC
* t.localtime("-09:00") # => 2000-01-01 11:15:01 -0900