Esempio n. 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));
        }
Esempio n. 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));
        }