fix: try to remove timezone offseet in bisect
This commit is contained in:
parent
4b48357ab6
commit
7946cb6e96
@ -1,5 +1,5 @@
|
|||||||
import { getLatestVideos } from "lib/net/getLatestVideos.ts";
|
import { getLatestVideos } from "lib/net/getLatestVideos.ts";
|
||||||
import { HOUR, SECOND } from "$std/datetime/constants.ts";
|
import { SECOND } from "$std/datetime/constants.ts";
|
||||||
import { VideoListVideo } from "lib/net/bilibili.d.ts";
|
import { VideoListVideo } from "lib/net/bilibili.d.ts";
|
||||||
|
|
||||||
export async function getVideoPositionInNewList(timestamp: number): Promise<number | null | VideoListVideo[]> {
|
export async function getVideoPositionInNewList(timestamp: number): Promise<number | null | VideoListVideo[]> {
|
||||||
@ -19,7 +19,7 @@ export async function getVideoPositionInNewList(timestamp: number): Promise<numb
|
|||||||
if (!lastVideo || !lastVideo.pubdate) {
|
if (!lastVideo || !lastVideo.pubdate) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const lastTime = lastVideo.pubdate * SECOND + 8 * HOUR;
|
const lastTime = lastVideo.pubdate * SECOND
|
||||||
if (lastTime <= timestamp && highPage == 1) {
|
if (lastTime <= timestamp && highPage == 1) {
|
||||||
return videos;
|
return videos;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ export async function getVideoPositionInNewList(timestamp: number): Promise<numb
|
|||||||
hi = mid - 1;
|
hi = mid - 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const lastTime = lastVideo.pubdate * SECOND + 8 * HOUR;
|
const lastTime = lastVideo.pubdate * SECOND
|
||||||
if (lastTime > timestamp) {
|
if (lastTime > timestamp) {
|
||||||
lo = mid + 1;
|
lo = mid + 1;
|
||||||
} else {
|
} else {
|
||||||
@ -71,7 +71,7 @@ export async function getVideoPositionInNewList(timestamp: number): Promise<numb
|
|||||||
if (!video.pubdate) {
|
if (!video.pubdate) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const videoTime = video.pubdate * SECOND + 8 * HOUR;
|
const videoTime = video.pubdate * SECOND
|
||||||
if (videoTime > timestamp) {
|
if (videoTime > timestamp) {
|
||||||
indexInPage++;
|
indexInPage++;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user