예제 #1
0
            public void BackAndForth_UtcIn()
            {
                long     epoch    = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT
                DateTime utc      = UnixEpoch.AddMilliseconds(epoch);
                var      result   = SrkHtmlExtensions.JsDate(null, utc);
                var      expected = "new Date(13912786171000)";

                Assert.AreEqual(expected, result.ToString());
            }
예제 #2
0
            public void BackAndForth_LocalTzIn()
            {
                long     epoch    = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT
                DateTime utc      = UnixEpoch.AddMilliseconds(epoch);
                DateTime local    = utc.ToLocalTime();
                var      html     = CreateHtmlHelper(new ViewDataDictionary());
                var      result   = SrkHtmlExtensions.JsDate(html, local);
                var      expected = "new Date(13912786171000)";

                Assert.AreEqual(expected, result.ToString());
            }
예제 #3
0
            public void BackAndForth_UserTzIn()
            {
                long         epoch = 13912786171000L; // GMT: Sat, 01 Feb 2014 18:16:57 GMT
                DateTime     utc   = UnixEpoch.AddMilliseconds(epoch);
                TimeZoneInfo tz    = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time");
                DateTime     user  = tz.ConvertFromUtc(utc);
                var          html  = CreateHtmlHelper(new ViewDataDictionary());

                html.SetTimezone(tz);
                var result   = SrkHtmlExtensions.JsDate(html, user);
                var expected = "new Date(13912786171000)";

                Assert.AreEqual(expected, result.ToString());
            }