-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes an issue with search indexing and timezones #60
Fixes an issue with search indexing and timezones #60
Conversation
Search indexing uses utc times and the module was simply saving using the local webserver timezone. This PR adjusts the module in a few key ways: - Times in the database are saved using UTC times - Displayed times for users (templates) will try to use the user local time zone, if that fails it will fallback to the portal settings timezone and if that fails it will show the utc time. - In editing, it always uses the current portal timezone and it formats it using the current user prefered locale.
userPreferredCulture = new CultureInfo(user.Profile.PreferredLocale); | ||
} | ||
|
||
ctlAudit.CreatedDate = TimeZoneInfo.ConvertTimeFromUtc(Model.AnnouncementInfo.CreatedOnDate, ModuleContext.PortalSettings.TimeZone).ToString(userPreferredCulture); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be utc or portal time for the audit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it is in the portal preferred timezone but formatted in the current user culture, makes sense or I misenterpreted your comment ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @valadas - I'm sure this was fun to track down! 😆
Co-authored-by: David Poindexter <[email protected]>
Co-authored-by: David Poindexter <[email protected]>
Co-authored-by: David Poindexter <[email protected]>
Co-authored-by: David Poindexter <[email protected]>
Co-authored-by: David Poindexter <[email protected]>
Co-authored-by: David Poindexter <[email protected]>
Co-authored-by: David Poindexter <[email protected]>
userPreferredCulture = new CultureInfo(user.Profile.PreferredLocale); | ||
} | ||
|
||
ctlAudit.CreatedDate = TimeZoneInfo.ConvertTimeFromUtc(Model.AnnouncementInfo.CreatedOnDate, ModuleContext.PortalSettings.TimeZone).ToString(userPreferredCulture); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, looks good
Yeah, it was real fun, I love timezones (NOT), why could'nt we all just use the same time, I already wake up at 2pm and go to bed at 5 am anyway... |
Description of PR...
Fixes #59 and prevents marking the module last modified date when only changing settings.
Changes made
PR Template Checklist