namespace Jint.Runtime; /// /// Date related operations that can replaced with implementation that can handle also full IANA data as recommended /// by the JS spec. Jint comes with which is based on built-in data which might be incomplete. /// /// /// This interface intentionally uses long instead of DateTime/DateTimeOffset as DateTime/DateTimeOffset cannot handle /// neither negative years nor the date range that JS can. /// public interface ITimeSystem { /// /// Retrieves current UTC time. /// /// Current UTC time. DateTimeOffset GetUtcNow(); /// /// Return the default time zone system is using. Usually , but can be altered via /// engine configuration, see . /// TimeZoneInfo DefaultTimeZone { get; } /// /// Tries to parse given time presentation string as JS date presentation based on epoch. /// /// Date/time to parse. /// The milliseconds since the UNIX epoch, can be negative for values before 1970. /// true, if succeeded. bool TryParse(string date, out long epochMilliseconds); /// /// Retrieves UTC offset for given date presented as milliseconds since the Unix epoch. /// Defaults to using using the configured time zone. /// /// Date as milliseconds since the Unix epoch, may be negative (for instants before the epoch). /// public TimeSpan GetUtcOffset(long epochMilliseconds); }