Greasy Fork is available in English.

WaniKani Timeline

This UserScript is a descendant of the WaniKani Customizer Chrome Extension Timeline

< Обсуждения WaniKani Timeline

Вопрос/комментарий

Timezones

With the most recent update to this script, the time of when a review is has been added, however it is set to pacific time I believe. I adjusted my script so that line 308 under the function genDateStr to adjust to eastern standard time.

hours = (tDate.getHours() + 3) % 24;
Replaces
hours = tDate.getHours();

Where 3 is the offset from pacific to eastern time. I hope this helps some people

If your computer's time and timezone are set correctly it should just work.

If you want to offset hours in the script, you may also want to change line-489 in the drawTimeMark function.
It uses getHours() to determine which times to mark on top.

The previous version of the script used very similar code to generate time strings for the tooltips.
So if those were correct previously, they should still be correct.
Perhaps with the new version it is just more obviously wrong.

Supposedly getHours() returns hours adjusted for your computer's locally configured timezone.
So either that's not working in your browser for some reason or your system clock is set to the wrong timezone.

If you want to see what timezone your browser thinks you are, try pasting "String(new Date())" into javascript console.
It should tell you the current date, time, GMT-offset, and named timezone.
For example, I changed my computer timezone and got these:
"Mon Oct 12 2015 21:55:46 GMT-0700 (Pacific Standard Time)"
"Tue Oct 13 2015 00:56:30 GMT-0400 (Eastern Daylight Time)"
"Tue Oct 13 2015 04:55:38 GMT+0000 (Coordinated Universal Time)"

Relevant documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours
The getHours() method returns the hour for the specified date, according to local time.

Takuya KobayashiАвтор
§
Создано: 13.10.2015
Отредактировано: 16.10.2015

Thinking about it some more, if you just offset the hours like that, then the "day of the week" will be wrong sometimes.

I have added an hour-offset feature to 0.1.4, see 'options.hour_offset'.

Ответить

Войдите, чтобы ответить.