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

When year is in some far future - use offsets of some similar year before 2038 #881

Closed
wants to merge 1 commit into from

Conversation

ellenaua
Copy link
Contributor

@ellenaua ellenaua commented Aug 1, 2020

This is related to bugs:

#798
#768

@@ -169,6 +169,11 @@
return i;
}
}

var alternative = this._getAlternative(timestamp);

Choose a reason for hiding this comment

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

I don't think it makes sense for this logic to be in _index, since it's not returning the index for an until that represents the timestamp. It would have the correct offset. I think it would be better to create a different method that wraps this information instead, and have the other method call the existing _index.

@@ -330,6 +350,16 @@
}
}

function findYearLike(year) {
for (var j = 2038; j > 2000; j--) {

Choose a reason for hiding this comment

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

If we aren't worried about strange exceptions (like when a timezone skips a day entirely), we use the fact that there's a 28-year cycle in which the calendar repeats itself, instead of performing a loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I already fixed that, will push tomorrow, it was beta version to check if that logics (of searching similar years) will work at all

@@ -330,6 +350,16 @@
}
}

function findYearLike(year) {
for (var j = 2038; j > 2000; j--) {
if (new Date(year + '-01-01').getDay() === new Date(j + '-12-31').getDay() &&

Choose a reason for hiding this comment

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

You're repeating the same check here instead of comparing the first day of the week of the target year with the last day of the week of the candidate year, instead of comparing the first and last days of the week of the target year with those of the candidate year.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed that already, will push changes tomorrow

Choose a reason for hiding this comment

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

Any news about the fix @ellenaua ? :)

@micheleangioni
Copy link

@ellenaua any news about this PR? :)

@andywu0408
Copy link

Hi @ellenaua, May I ask if there is any update on this PR? Thanks a lot by the way!

@eramitmittal
Copy link

Please have a look at #921

@gilmoreorless
Copy link
Member

The problem I raised in #768 is not fixed by this PR, or by #921. See #825 for a related issue in the other direction (very old timestamps).

The core problem is that the current build process is highly dependent on the version of zdump provided by the machine of the person building a release. Since 0.5.26, it looks like releases are being run on macOS, where the in-built zdump only produces 32-bit data files. Previously the releases included 64-bit data files (but I'm not sure which OS they were running on).

Ideally there'd be a standardised CI setup for building new data files (using GitHub Actions or similar), which could better guarantee data quality. I could take a look into doing this, but to be honest, I don't see many contributor PRs being merged on this repo, so I'm not sure it would be accepted.

@ichernev
Copy link
Contributor

The core problem is that the current build process is highly dependent on the version of zdump

Ah, @gilmoreorless already troubleshooted this. Nice.

Closing this for now.

About using CI to release for a more stable result -- we could, as long as it's very transparent. Or we could have a small docker file in the repo and use that for zic/zdump.

@ichernev ichernev closed this Aug 28, 2022
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

7 participants