fix
This commit is contained in:
parent
cdeddab905
commit
35ec4ae7e7
|
@ -50,9 +50,11 @@ const props = defineProps<{
|
|||
|
||||
const now = useLowresTime();
|
||||
|
||||
const expiresAtTime = computed(() => props.expiresAt ? new Date(props.expiresAt).getTime() : null);
|
||||
|
||||
const remaining = computed(() => {
|
||||
if (props.expiresAt == null) return -1;
|
||||
return Math.floor(Math.max(new Date(props.expiresAt).getTime() - now.value, 0) / 1000);
|
||||
if (expiresAtTime.value == null) return -1;
|
||||
return Math.floor(Math.max(expiresAtTime.value - now.value, 0) / 1000);
|
||||
});
|
||||
|
||||
const total = computed(() => sum(props.choices.map(x => x.votes)));
|
||||
|
|
|
@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import isChromatic from 'chromatic/isChromatic';
|
||||
import { computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { dateTimeFormat } from '@@/js/intl-const.js';
|
||||
import { useLowresTime } from '@/composables/use-lowres-time.js';
|
||||
|
@ -47,7 +47,8 @@ const _time = props.time == null ? NaN : getDateSafe(props.time).getTime();
|
|||
const invalid = Number.isNaN(_time);
|
||||
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
|
||||
|
||||
const now = useLowresTime();
|
||||
const actualNow = useLowresTime();
|
||||
const now = computed(() => (props.origin ? props.origin.getTime() : actualNow.value));
|
||||
|
||||
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
||||
const ago = computed(() => (now.value - _time) / 1000/*ms*/);
|
||||
|
|
Loading…
Reference in New Issue