Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Present User Selected Time and Now in UTC format #161

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

Conversation

mengyaoyang11
Copy link
Contributor

@mengyaoyang11 mengyaoyang11 commented Jun 14, 2021

Problem statement:
Currently clicking the "Now" button sends the local time now to the query, not the UTC time, since there is a time difference between local time(either in the US or in India) and UTC, if the sloop instance is not running during that time period, we will get an empty screen after clicking the 'Now' button. This is expected behavior, customer who keeps running sloop for a long time will not have this issue.

Solution:
Display both customer selected time and now in UTC format

@@ -532,13 +533,13 @@ $(document).ready(function() {
&& ! Date.parse(sessionStorage.getItem('setSelectedEndTime')) < new Date(userDate.getTime() - 3000)){
userDate = new Date(sessionStorage.getItem('selectedEndTime'));
}
userDate.setMinutes(now.getMinutes() - now.getTimezoneOffset());
userDate.setMinutes(userDate.getMinutes() - userDate.getTimezoneOffset());
Copy link
Contributor

Choose a reason for hiding this comment

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

does .getUTCMinutes() (as seen line 542) work here?

Copy link
Contributor Author

@mengyaoyang11 mengyaoyang11 Jun 14, 2021

Choose a reason for hiding this comment

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

Tried .getUTCMinutes() here as well but not producing the same behavior. Will talk to Sana as she was concerned with the timezone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@duke-harlan Updated the pr to address the comment: use one technique to present both user selected time and now to local time. Please review again

duke-harlan
duke-harlan previously approved these changes Jun 14, 2021
Copy link
Contributor

@duke-harlan duke-harlan left a comment

Choose a reason for hiding this comment

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

it looks like we're using 2 techniques to accomplish the same change - if they produce the same behavior, lets stick with just one

duke-harlan
duke-harlan previously approved these changes Jun 15, 2021
@mengyaoyang11 mengyaoyang11 changed the title Switch Now from local time to UTC time Present User Selected Time and Now in local format Jun 15, 2021
Copy link
Collaborator

@sana-jawad sana-jawad left a comment

Choose a reason for hiding this comment

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

Please make sure the same time zone is used across.

@mengyaoyang11 mengyaoyang11 changed the title Present User Selected Time and Now in local format Present User Selected Time and Now in UTC format Jun 16, 2021
@mengyaoyang11 mengyaoyang11 merged commit e86b222 into salesforce:master Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants