コード例 #1
0
        /// <inheritdoc/>
        public DateTime?Convert(DateTime?date)
        {
            if (!date.HasValue)
            {
                return(null);
            }

            if (!Clock.SupportsMultipleTimezone)
            {
                return(date);
            }

            var applicationsTimezone = _settingManager.GetSettingValueForApplication(TimingSettingNames.TimeZone);

            if (string.IsNullOrEmpty(applicationsTimezone))
            {
                return(date);
            }

            return(TimezoneHelper.ConvertFromUtc(date.Value.ToUniversalTime(), applicationsTimezone));
        }
コード例 #2
0
        /// <inheritdoc/>
        public DateTime?Convert(DateTime?date, int?tenantId, long userId)
        {
            if (!date.HasValue)
            {
                return(null);
            }

            if (!Clock.SupportsMultipleTimezone)
            {
                return(date);
            }

            var usersTimezone = _settingManager.GetSettingValueForUser(TimingSettingNames.TimeZone, tenantId, userId);

            if (string.IsNullOrEmpty(usersTimezone))
            {
                return(date);
            }

            return(TimezoneHelper.ConvertFromUtc(date.Value.ToUniversalTime(), usersTimezone));
        }