Skip to content

Instantly share code, notes, and snippets.

@soen
Last active July 6, 2016 09:47
Show Gist options
  • Save soen/5858e7d63c21a46a296c4846aaedcff9 to your computer and use it in GitHub Desktop.
Save soen/5858e7d63c21a46a296c4846aaedcff9 to your computer and use it in GitHub Desktop.
// Decompiled with JetBrains decompiler
// Type: Sitecore.Web.WebEditUtil
// Assembly: Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null
//
// NOTE: This is not the complete implementation, only fractions of the important parts related to the date and time.
//
namespace Sitecore.Web
{
public static class WebEditUtil
{
public static DateTime GetCurrentDate()
{
SiteContext site = Factory.GetSite(WebEditUtil.SiteName);
Assert.IsNotNull((object) site, "Site \"{0}\" not found.", (object) Settings.Preview.DefaultSite);
string cookieValue = WebUtil.GetCookieValue(site.GetCookieKey("sc_date"));
if (string.IsNullOrEmpty(cookieValue))
return DateTime.UtcNow;
return DateUtil.ToUniversalTime(DateUtil.IsoDateToDateTime(cookieValue));
}
// code omitted...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment