Skip to content

Commit

Permalink
test y
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Nov 23, 2023
1 parent 9b18739 commit 8acd55e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Jint/Native/Date/DatePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ private string TimeZoneString(DatePresentation tv)
var offsetMin = MinFromTime(absOffset).ToString("00", CultureInfo.InvariantCulture);
var offsetHour = HourFromTime(absOffset).ToString("00", CultureInfo.InvariantCulture);

var tzName = " (" + TimeZoneInfo.Local.StandardName + ")";
var tzName = " (" + _timeSystem.DefaultTimeZone.StandardName + ")";

return offsetSign + offsetHour + offsetMin + tzName;
}
Expand Down
9 changes: 7 additions & 2 deletions Jint/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ namespace Jint
public class Options
{
private static readonly CultureInfo _defaultCulture = CultureInfo.CurrentCulture;
private static readonly TimeZoneInfo _defaultTimeZone = TimeZoneInfo.Local;

private ITimeSystem? _timeSystem;
private TimeZoneInfo? _timeZone;

internal List<Action<Engine>> _configurations { get; } = new();

/// <summary>
Expand Down Expand Up @@ -75,7 +76,11 @@ public ITimeSystem TimeSystem
/// <summary>
/// The time zone the engine runs on, defaults to local. Same as setting DefaultTimeSystem with the time zone.
/// </summary>
public TimeZoneInfo TimeZone { get; set; } = _defaultTimeZone;
public TimeZoneInfo TimeZone
{
get => _timeZone ??= TimeZoneInfo.Local;
set => _timeZone = value;
}

/// <summary>
/// Reference resolver allows customizing behavior for reference resolving. This can be useful in cases where
Expand Down

0 comments on commit 8acd55e

Please sign in to comment.