Skip to content
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

Merged
merged 9 commits into from
Sep 5, 2020

Conversation

valadas
Copy link
Member

@valadas valadas commented Sep 4, 2020

Description of PR...

Fixes #59 and prevents marking the module last modified date when only changing settings.

Changes made

  • Ensures all DataStore usage of times are in UTC
  • Prevents marking the module last modified date when only changing settings

PR Template Checklist

  • Fixes Bug
  • Feature solution
  • Other

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.
@valadas valadas added the bug label Sep 4, 2020
@valadas valadas added this to the 7.2.4 milestone Sep 4, 2020
userPreferredCulture = new CultureInfo(user.Profile.PreferredLocale);
}

ctlAudit.CreatedDate = TimeZoneInfo.ConvertTimeFromUtc(Model.AnnouncementInfo.CreatedOnDate, ModuleContext.PortalSettings.TimeZone).ToString(userPreferredCulture);

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

Copy link
Member Author

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 ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, looks good

Copy link
Contributor

@david-poindexter david-poindexter left a 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! 😆

AnnouncementsEdit.ascx.cs Outdated Show resolved Hide resolved
AnnouncementsEdit.ascx.cs Outdated Show resolved Hide resolved
AnnouncementsEdit.ascx.cs Outdated Show resolved Hide resolved
Components/Business/AnnouncementsController.cs Outdated Show resolved Hide resolved
Components/Business/AnnouncementsController.cs Outdated Show resolved Hide resolved
Components/Business/AnnouncementsController.cs Outdated Show resolved Hide resolved
Components/Business/AnnouncementsController.cs Outdated Show resolved Hide resolved
Components/Business/AnnouncementsController.cs Outdated Show resolved Hide resolved
userPreferredCulture = new CultureInfo(user.Profile.PreferredLocale);
}

ctlAudit.CreatedDate = TimeZoneInfo.ConvertTimeFromUtc(Model.AnnouncementInfo.CreatedOnDate, ModuleContext.PortalSettings.TimeZone).ToString(userPreferredCulture);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, looks good

@valadas
Copy link
Member Author

valadas commented Sep 5, 2020

Looks good @valadas - I'm sure this was fun to track down! 😆

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...

@valadas valadas merged commit e2f55b3 into DNNCommunity:development Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search indexer stops working after changing module settings
3 participants