public ToLocalTimeTransform( IContext context = null, IClock clock = null, ILocalClock localClock = null ) : base(context, "datetime") { if (IsMissingContext()) { return; } if (IsNotReceiving("date")) { return; } _input = SingleInput(); _clock = clock; var localTimeZone = localClock.GetLocalTimeZoneAsync().Result; _transform = (dt) => { if (dt.Kind != DateTimeKind.Utc) { dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); } return(_clock.ConvertToTimeZone(dt, localTimeZone).DateTime); }; }
public UnpublishLaterPartDisplayDriver( IHttpContextAccessor httpContextAccessor, IAuthorizationService authorizationService, ILocalClock localClock) { _httpContextAccessor = httpContextAccessor; _authorizationService = authorizationService; _localClock = localClock; }
/// <summary> /// Converts the given local date to UTC using the given time-zone by temporarily setting it in the HTTP /// context. /// </summary> /// <param name="dateTimeLocal">Local date.</param> /// <param name="timeZoneId">IANA time-zone ID.</param> /// <param name="localClock">IANA time-zone ID.</param> /// <param name="httpContext">HTTP context to be used to temporarily set in the HTTP context.</param> /// <returns>UTC date.</returns> public static async Task <DateTime> ConvertToUtcAsync( this ILocalClock localClock, DateTime dateTimeLocal, string timeZoneId, HttpContext httpContext) => await ExecuteInDifferentTimeZone( httpContext, timeZoneId, async() => await localClock.ConvertToUtcAsync(dateTimeLocal));
public DateTimeShapes( IClock clock, IPluralStringLocalizer <DateTimeShapes> localizer, ILocalClock localClock ) { _localClock = localClock; _clock = clock; T = localizer; }
public DateTimeShapes( IClock clock, IStringLocalizer <DateTimeShapes> localizer, IHtmlLocalizer <DateTimeShapes> htmlLocalizer, ILocalClock localClock ) { _localClock = localClock; _clock = clock; T = localizer; H = htmlLocalizer; }
public DateTimeCachingService( IMemoryCache memoryCache, ILocalClock localClock, IDynamicCacheService dynamicCacheService, ITagCache tagCache, ISignal signal) { _memoryCache = memoryCache; _localClock = localClock; _dynamicCacheService = dynamicCacheService; _tagCache = tagCache; _signal = signal; }
/// <summary> /// Converts the given UTC date to the given time-zone by temporarily setting it in the HTTP context. /// </summary> /// <param name="dateTimeUtc">UTC date.</param> /// <param name="timeZoneId">IANA time-zone ID.</param> /// <param name="localClock">IANA time-zone ID.</param> /// <param name="httpContext">HTTP context to be used to temporarily set in the HTTP context.</param> /// <returns>Local date.</returns> public static async Task <DateTime> ConvertToLocalAsync( this ILocalClock localClock, DateTime dateTimeUtc, string timeZoneId, HttpContext httpContext) => (await ExecuteInDifferentTimeZone( httpContext, timeZoneId, async() => await localClock.ConvertToLocalAsync( new DateTimeOffset( dateTimeUtc.Kind != DateTimeKind.Utc ? new DateTime(dateTimeUtc.Ticks, DateTimeKind.Utc) : dateTimeUtc)))).DateTime;
public DefaultAuditTrailAdminListQueryService( IAuditTrailManager auditTrailManager, ILocalClock localClock, IOptions <AuditTrailAdminListOptions> adminListOptions, ISession session, IServiceProvider serviceProvider, IStringLocalizer <DefaultAuditTrailAdminListQueryService> stringLocalizer, ILogger <DefaultAuditTrailAdminListQueryService> logger) { _auditTrailManager = auditTrailManager; _localClock = localClock; _adminListOptions = adminListOptions.Value; _session = session; _serviceProvider = serviceProvider; S = stringLocalizer; _logger = logger; }
/// <summary> /// Converts a <see cref="DateTime" /> to the specified <see cref="ITimeZone" /> instance. /// </summary> public static Task <DateTimeOffset> ConvertToLocalAsync(this ILocalClock localClock, DateTime dateTime) { DateTime dateTimeUtc; switch (dateTime.Kind) { case DateTimeKind.Utc: dateTimeUtc = dateTime; break; case DateTimeKind.Local: dateTimeUtc = dateTime.ToUniversalTime(); break; default: //DateTimeKind.Unspecified dateTimeUtc = DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); break; } return(localClock.ConvertToLocalAsync(new DateTimeOffset(dateTimeUtc))); }
public OrchardContainer( IHttpContextAccessor httpContext, IFileService fileService, IUserService userService, IServiceProvider serviceProvider, CombinedLogger <OrchardContainer> logger, IClock clock, ILocalClock localClock, IMemoryCache memoryCache, ISignal signal ) { _httpContext = httpContext; _userService = userService; _serviceProvider = serviceProvider; _logger = logger; _memoryCache = memoryCache; _signal = signal; _clock = clock; _localClock = localClock; _fileService = fileService; }
public DateTimeFieldDisplayDriver(ILocalClock localClock, IStringLocalizer <DateTimeFieldDisplayDriver> localizer) { _localClock = localClock; S = localizer; }
public DateEditorDriver(IContentDefinitionManager contentDefinitionManager, ILocalClock localClock) { _contentDefinitionManager = contentDefinitionManager; _localClock = localClock; }
public DateTimeFieldDisplayDriver(ILocalClock localClock) { _localClock = localClock; }
public DateEditorDriver(ILocalClock localClock) { _localClock = localClock; }
public TimeZoneFilter(ILocalClock localClock) { _localClock = localClock; }
public CacheController(IMemoryCache memoryCache, ILocalClock localClock, ISignal signal) { _memoryCache = memoryCache; _localClock = localClock; _signal = signal; }