Beispiel #1
0
 public string TimeZonePresentation(string id)
 {
     try
     {
         return(TimeZoneConverter.TimeZonePresentation(id));
     }
     catch (TimeZoneNotFoundException)
     {
         throw RuntimeException.InvalidNthArgumentValue(1);
     }
 }
Beispiel #2
0
 public int StandardTimeOffset(string timeZone = null, IValue universalTime = null)
 {
     try
     {
         return(TimeZoneConverter.StandardTimeOffset(timeZone, universalTime?.AsDate()));
     }
     catch (TimeZoneNotFoundException)
     {
         throw RuntimeException.InvalidNthArgumentValue(1);
     }
 }
Beispiel #3
0
 public IValue ToUniversalTime(IValue localTime, string timeZone = null)
 {
     try
     {
         var dt = TimeZoneConverter.ToUniversalTime(localTime.AsDate(), timeZone);
         return(ValueFactory.Create(dt));
     }
     catch (TimeZoneNotFoundException)
     {
         throw RuntimeException.InvalidNthArgumentValue(2);
     }
 }
Beispiel #4
0
 public ArrayImpl GetAvailableTimeZones()
 {
     return(new ArrayImpl(TimeZoneConverter.GetAvailableTimeZones()
                          .Select(x => ValueFactory.Create(x))));
 }
Beispiel #5
0
 public string TimeZone()
 {
     return(TimeZoneConverter.TimeZone());
 }