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

fix for fractional offset (minutes support) #655

Closed
wants to merge 1 commit into from

Conversation

AbhimanyuG
Copy link

@AbhimanyuG AbhimanyuG commented Mar 8, 2023

fix for #568


// remainder of division by 60
let remainder = offset - Math.floor(offset);
const remainderMins = remainder * 60;
Copy link
Collaborator

Choose a reason for hiding this comment

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

rather than use a decimal fraction and multiply it by 60, since we already have access to the minutes with this.utcOffset, could you use that to calculate the remaining minutes? like remainderMins = this.utcOffset - (offset * 60)? just to minimize the risk of JS weirdness with decimal fractions

while you're there feel free to use Math.floor(offset) instead of parseInt(offset) and move it above the code you're adding

@intcreator
Copy link
Collaborator

hey thanks for your PR! I added a comment and ran the tests for you

@rharshit82
Copy link
Contributor

Hi, @intcreator Should I create a new PR for this issue since there has been no activity for a long time? with changes for your comments.

@sheerlox
Copy link
Collaborator

Superseded by #685

@sheerlox sheerlox closed this Aug 13, 2023
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.

4 participants