-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: Send event startsAt and endsAt time in event timezone #3633
fix: Send event startsAt and endsAt time in event timezone #3633
Conversation
@iamareebjamal Please review. |
app/utils/computed-helpers.js
Outdated
@@ -47,13 +47,13 @@ export const computedSegmentedLink = function(property) { | |||
export const computedDateTimeSplit = function(property, segmentFormat, endProperty) { | |||
return computed(property, { | |||
get() { | |||
return moment(this.get(property)).format(getFormat(segmentFormat)); | |||
return moment(this.get(property)).tz(this.timezone).format(getFormat(segmentFormat)); |
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.
Will fail for everything except event
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.
@prateekj117 Dont send the timezone with time, as we are already collecting timezone in seperate field. I dont think sending timezone with date & time would be mandatory.
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.
It is mandatory. As I said, please read about moment and timezones and ISO 8601 format a bit more
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.
@iamareebjamal So adding a if conditional should work in that case here.
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.
Yes
@prateekj117 Status? |
@iamareebjamal I am having an issue in case of |
Just handle the case for event wizard right now and open an issue to handle others |
Use a if condition just to handle the event case, session and speaker can
be handled after the release.
…On Tue, 19 Nov, 2019, 00:23 Areeb Jamal, ***@***.***> wrote:
Just handle the case for event wizard right now and open an issue to
handle others
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3633?email_source=notifications&email_token=AKQMTLSFEJ42CV5FNDVDYVTQULQDFA5CNFSM4JOGQOQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELQMXA#issuecomment-555157084>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKQMTLUFMGYWYIBHZ4IS76LQULQDFANCNFSM4JOGQOQA>
.
|
@iamareebjamal Please review. |
@iamareebjamal Please review. |
app/utils/computed-helpers.js
Outdated
} else { | ||
return moment(this.get(property)).format(getFormat(segmentFormat)); | ||
timezone = this.event.get('timezone'); |
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.
This is worse than before
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.
Idea is to write less code, not more
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.
So, make this work in least code possible, please
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 don't want to assign a variable outside if as it may crash the page of the other model inside an if condition.
For example:
let timezone = this.timezone;
if(this.constuctor.modelName !== 'event') {
timezone = this.event.get('timezone');
}
This may break in session-speakers page, as it will first search for this.timezone.
Normally, I'd wait for you to figure out this so you learn and develop an insight of how to write concise code and not duplicate anything, but since this PR has already delayed the release a lot, this is what you should do: let momentDate = moment(this.get(property));
if (this.constructor.modelName === 'event')
momentDate = momentDate.tz(this.timezone)
return momentDate.format(getFormat(segmentFormat)); |
And as said previously, only handle event case as we don't know the effects of changing behaviours of sessions and tracks. And we don't have devs and time to test it out. They are not immediate bugs and fixing them may break the site even more. As discussed, they are planned for next release. Perfection is the killer of pragmatism |
app/utils/computed-helpers.js
Outdated
} else { | ||
timezone = this.event.get('timezone'); | ||
} | ||
oldDate = moment(this.get(property), segmentFormat === 'date' ? FORM_DATE_FORMAT : FORM_TIME_FORMAT).tz(timezone, true); |
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.
Somehow you managed to increase the duplication even more from previous iteration
app/utils/computed-helpers.js
Outdated
timezone = ''; | ||
if (this.constructor.modelName === 'event') { | ||
timezone = this.timezone; | ||
} else { | ||
timezone = this.event.get('timezone'); | ||
} |
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 don't even understand why this block of code is repeated here in this if statement.
34103b4
to
d126fc2
Compare
Complexity increasing per file
==============================
- app/utils/computed-helpers.js 2
See the complete overview on Codacy |
@iamareebjamal Please review. |
@prateekj117 Are you sure the time is being sent into event timezone after this ? |
I tried it and time was stored in my browser timezone only . |
Yes, I tested it personally |
How did you test that? |
I pulled the changes and created new event and accessed the database to see
the time.
…On Wed, 20 Nov, 2019, 14:59 Areeb Jamal, ***@***.***> wrote:
time was stored in my browser timezone only
How did you test that?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3633?email_source=notifications&email_token=AKQMTLR5ET5WWDMM4EKU46TQUT7RLA5CNFSM4JOGQOQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEERKMSA#issuecomment-555918920>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKQMTLQBOAIXSCM3VUU327DQUT7RLANCNFSM4JOGQOQA>
.
|
And what did you find? Please tell completely. What you did, which timezone you selected, what time did you input and what did you find in DB, and what you expected to find in the DB instead. Steps of Reproduction, Expected, Actual. |
Its working fine, I checked the time for older event.
Sorry for the confusion.
…On Wed, 20 Nov, 2019, 15:13 Areeb Jamal, ***@***.***> wrote:
And what did you find? Please tell completely. What you did, which
timezone you selected, what time did you input and what did you find in DB,
and what you expected to find in the DB instead.
Steps of Reproduction, Expected, Actual.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3633?email_source=notifications&email_token=AKQMTLSDRCV4JPT46MVYJSTQUUBELA5CNFSM4JOGQOQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEERLWRY#issuecomment-555924295>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKQMTLW24X7K5MUJB7FX7TDQUUBELANCNFSM4JOGQOQA>
.
|
Fixes #3632
Short description of what this resolves:
Send event timings in event timezone and render time correctly on event basic details page.
Checklist
development
branch.