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

Show analytics table data Date column in user's local time zone #2273

Merged
merged 4 commits into from
Mar 14, 2017

Conversation

snittoor
Copy link

@snittoor snittoor commented Mar 10, 2017

Displays analytics table data Date column in user's local time zone.

#2183

let localTime = moment.utc(e.fields.request_at[0]).toISOString();
localTime = moment.utc(localTime).toDate();

try { time = localTime; } catch (err) { time = ''; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use try/catch for conditional logic. Use if/else, or something similar.

Try/catch are for error handling.

Copy link
Author

Choose a reason for hiding this comment

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

The complete table is populated using try .. catch logic. So i did not alter the code. Let me know if i need to change it to if--else logic.

let localTime = moment.utc(e.fields.request_at[0]).toISOString();
localTime = moment.utc(localTime).toDate();

try { time = localTime; } catch (err) { time = ''; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comments describing what this code is intended to do. Why is it written?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry i should have added comments.

const UsernameRegEx = /^(?!\d)(?!.*-.*-)(?!.*-$)(?!-)[a-zA-Z0-9-]{3,15}$/;
// Username must be 3-15 alphanumeric string combinations with hyphens and underscore allowed
// Username cannot begin with a hypen , underscore
const UsernameRegEx = /^(?!-)(?!_)[a-zA-Z0-9-_]{3,15}$/;
Copy link
Contributor

Choose a reason for hiding this comment

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

This belongs in a different pull request, and should not be part of this review.

@brylie
Copy link
Contributor

brylie commented Mar 13, 2017

This looks alright. We can ignore the try/catch usage here. Just be aware not to use try/catch when you need an if/else.

@brylie
Copy link
Contributor

brylie commented Mar 13, 2017

Please resolve the conflicts, and I will merge.

@55
Copy link
Contributor

55 commented Mar 13, 2017

Changes look good. @snittoor please resolve the conflicts.

@snittoor
Copy link
Author

@NNN , @brylie : Done conflict resolved , Could you please review.

@55 55 merged commit 19543cf into develop Mar 14, 2017
@55 55 deleted the userTimeZone branch March 14, 2017 06:22
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.

None yet

3 participants