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

Fixed zonedTimeToUtc not working with year < 100. #170

Merged
merged 1 commit into from Mar 31, 2022

Conversation

make-github-pseudonymous-again
Copy link
Contributor

Fixes #87.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not think linting was run on this commit. eslint barfs something about a deprecation warning:

(node:620180) [ESLINT_PERSONAL_CONFIG_SUPPRESS] DeprecationWarning: '~/.eslintrc.*' config files have been deprecated. Please remove it or add 'root:true' to the config files in your projects in order to avoid loading '~/.eslintrc.*' accidentally. (found in "../../../.eslintrc")
(Use `node --trace-deprecation ...` to show where the warning was created)

Did I do something wrong?

Comment on lines +39 to +43
var tmp = new Date(0)
tmp.setUTCFullYear(d.getFullYear(), d.getMonth(), d.getDate())
tmp.setUTCHours(d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds())

var utc = tmp.getTime()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor using new helper functions in tzParseTimezone?

function calcOffset(date, timezoneString) {
var tokens = tzTokenizeDate(date, timezoneString)

var asUTC = Date.UTC(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5])
var asUTC = DateUTC(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5], 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems milliseconds are dropped here, intentional? I can write a second PR to fix that.

src/_lib/tzTokenizeDate/test.js Outdated Show resolved Hide resolved
@marnusw
Copy link
Owner

marnusw commented Mar 25, 2022

@make-github-pseudonymous-again thank you for working on this. I'd be happy to merge this in once completed and the conflicts resolved.

@make-github-pseudonymous-again
Copy link
Contributor Author

@make-github-pseudonymous-again thank you for working on this. I'd be happy to merge this in once completed and the conflicts resolved.

@marnusw I rebased and fixed the test with the extra trailing zero. What about linting? I think the other comments I made can be addressed in a different PR.

@marnusw marnusw merged commit 120df19 into marnusw:master Mar 31, 2022
marnusw added a commit that referenced this pull request Mar 31, 2022
marnusw added a commit that referenced this pull request Mar 31, 2022
@marnusw
Copy link
Owner

marnusw commented Mar 31, 2022

Released in v1.3.2.

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.

Years below 100 not allowed?
2 participants