generated from VLADIMIR/template_frontend
add create game
This commit is contained in:
@@ -19,6 +19,7 @@ import { getURL } from '@/api/generated/crabs/evening_detective_server/client'
|
||||
import HeaderMenu from '@/components/HeaderMenu.vue'
|
||||
import { useSimplePolling } from '@/composables/useSimplePolling'
|
||||
import { applicationFileType, applicationFileURL } from '@/utils/application'
|
||||
import { formatGameDateTime, parseDateWithoutTimezone } from '@/utils/datetime'
|
||||
|
||||
const client = getAuthClient()
|
||||
const router = useRouter()
|
||||
@@ -345,18 +346,6 @@ async function saveAllScores() {
|
||||
await loadGameAnswers()
|
||||
}
|
||||
|
||||
function parseDateWithoutTimezone(dateStr: string): Date {
|
||||
// Разбираем ISO строку: "2024-01-01T12:30:00"
|
||||
const [datePart, timePart] = dateStr.split('T')
|
||||
const [year, month, day] = datePart.split('-').map(Number)
|
||||
|
||||
const correctTimePart = timePart.split('.')[0]
|
||||
const [hours, minutes, seconds] = (correctTimePart || '00:00:00').split(':').map(Number)
|
||||
|
||||
// Создаем дату в UTC, чтобы избежать сдвига
|
||||
return new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds || 0))
|
||||
}
|
||||
|
||||
function getCurrentUTC(): Date {
|
||||
const now = new Date()
|
||||
return new Date(now.getTime() - now.getTimezoneOffset() * 60000)
|
||||
@@ -407,6 +396,9 @@ useSimplePolling(() => {
|
||||
<n-tag type="info">
|
||||
{{ timeString }}
|
||||
</n-tag>
|
||||
<n-tag v-if="formatGameDateTime(game.startAt)" type="info">
|
||||
Начало: {{ formatGameDateTime(game.startAt) }}
|
||||
</n-tag>
|
||||
</n-space>
|
||||
|
||||
<n-flex justify="end">
|
||||
|
||||
Reference in New Issue
Block a user