This is my first time posting from Japan.
Is TimeZone wrong?
There was no problem with New_York time, but I can’t find Japan time.
package main
import "core:fmt"
import "core:time"
import "core:time/datetime"
import "core:time/timezone"
main :: proc() {
tz, tz_err := timezone.region_load("Asia/Tokyo") // true
// tz, tz_err := timezone.region_load("America/New_York") // true
fmt.println("timezone: ", tz, tz_err)
dt, _ := time.time_to_datetime( time.now() )
fmt.println("datetime: ", dt)
dt_jp, dt_jp_err := timezone.datetime_to_tz(dt, tz)
fmt.println("japan datetime: ", dt_jp, dt_jp_err)
}
As a result, the program crashes
timezone: &TZ_Region{name = "Asia/Tokyo", records = [], shortnames = [], rrule = TZ_RRule{has_dst = true, std_name = "JST", std_offset = 32400, std_date = TZ_Transition_Date{type = "Month_Week_Day", month = 0, week = 0, day = 0, time = 0}, dst_name = "JST", dst_offset = 36000, dst_date = TZ_Transition_Date{type = "Month_Week_Day", month = 0, week = 0, day = 0, time = 0}}} true
datetime: DateTime{date = Date{year = 2024, month = 11, day = 5}, time = Time{hour = 10, minute = 32, second = 7, nano = 244868100}, tz = <nil>}
E:/Dev/lang/odin/core/time/timezone/tzdate.odin(77:21) Index -1 is out of range 0..<12
my PC environment
Windows 11
odin.exe version dev-2024-11-nightly