Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Time/Zone.pm
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ CONFIG: {
# "it" => +3*3600+1800,# Iran
"zp4" => +4*3600, # USSR Zone 3
"zp5" => +5*3600, # USSR Zone 4
# "ist" => +5*3600+1800,# Indian Standard
"ist" => +5*3600+1800,# Indian Standard
"zp6" => +6*3600, # USSR Zone 5
# For completeness. NST is also Newfoundland Stanard, and SST is also Swedish Summer.
# "nst" => +6*3600+1800,# North Sumatra
Expand Down
18 changes: 17 additions & 1 deletion t/cpanrt.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use Date::Format qw(time2str strftime);
use Date::Parse qw(strptime str2time);

print "1..9\n";
print "1..11\n";

my $i = 1;

Expand Down Expand Up @@ -63,3 +63,19 @@ my $i = 1;
print "not " unless $year_parsed_as == $target_year;
print "ok ", $i++, "\n";
}

{ # IST (Indian Standard Time) should resolve to UTC+5:30
use Time::Zone;

my $offset = tz_offset("ist");
print "# tz_offset('ist') = $offset (expected 19800)\n";
print "not " unless defined $offset && $offset == 19800;
print "ok ", $i++, "\n";

# Verify parsing a date with IST timezone
my $time = str2time("2024-01-15 12:00:00 IST");
my $time_utc = str2time("2024-01-15 06:30:00 UTC");
print "# str2time IST=$time UTC=$time_utc\n";
print "not " unless defined $time && defined $time_utc && $time == $time_utc;
print "ok ", $i++, "\n";
}