CustomRPC: Change timestamp to milisecond (#2231)

This commit is contained in:
AutumnVN 2024-03-07 19:51:14 +07:00 committed by Luna
parent 025063d7d4
commit da4d80f74d

View file

@ -175,7 +175,7 @@ const settings = definePluginSettings({
}, },
startTime: { startTime: {
type: OptionType.NUMBER, type: OptionType.NUMBER,
description: "Start timestamp (only for custom timestamp mode)", description: "Start timestamp in milisecond (only for custom timestamp mode)",
onChange: onChange, onChange: onChange,
disabled: isTimestampDisabled, disabled: isTimestampDisabled,
isValid: (value: number) => { isValid: (value: number) => {
@ -185,7 +185,7 @@ const settings = definePluginSettings({
}, },
endTime: { endTime: {
type: OptionType.NUMBER, type: OptionType.NUMBER,
description: "End timestamp (only for custom timestamp mode)", description: "End timestamp in milisecond (only for custom timestamp mode)",
onChange: onChange, onChange: onChange,
disabled: isTimestampDisabled, disabled: isTimestampDisabled,
isValid: (value: number) => { isValid: (value: number) => {
@ -313,12 +313,12 @@ async function createActivity(): Promise<Activity | undefined> {
switch (settings.store.timestampMode) { switch (settings.store.timestampMode) {
case TimestampMode.NOW: case TimestampMode.NOW:
activity.timestamps = { activity.timestamps = {
start: Math.floor(Date.now() / 1000) start: Date.now()
}; };
break; break;
case TimestampMode.TIME: case TimestampMode.TIME:
activity.timestamps = { activity.timestamps = {
start: Math.floor(Date.now() / 1000) - (new Date().getHours() * 3600) - (new Date().getMinutes() * 60) - new Date().getSeconds() start: Date.now() - (new Date().getHours() * 3600 + new Date().getMinutes() * 60 + new Date().getSeconds()) * 1000
}; };
break; break;
case TimestampMode.CUSTOM: case TimestampMode.CUSTOM: