UBERF-4510 (#4131)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-12-04 14:15:16 +06:00 committed by GitHub
parent f11d38c019
commit 4b28460540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,21 +33,22 @@
getMonday, getMonday,
getWeekDayName, getWeekDayName,
resizeObserver, resizeObserver,
showPopup showPopup,
ticker
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { Menu } from '@hcengineering/view-resources' import { Menu } from '@hcengineering/view-resources'
import { createEventDispatcher, onDestroy, onMount } from 'svelte' import { createEventDispatcher, onDestroy, onMount } from 'svelte'
import type {
CalendarADGrid,
CalendarADRows,
CalendarCell,
CalendarElement,
CalendarElementRect,
CalendarGrid
} from '..'
import calendar from '../plugin' import calendar from '../plugin'
import { isReadOnly, updateReccuringInstance } from '../utils' import { isReadOnly, updateReccuringInstance } from '../utils'
import EventElement from './EventElement.svelte' import EventElement from './EventElement.svelte'
import type {
CalendarGrid,
CalendarADGrid,
CalendarADRows,
CalendarElementRect,
CalendarElement,
CalendarCell
} from '..'
export let events: Event[] export let events: Event[]
export let mondayStart = true export let mondayStart = true
@ -65,7 +66,16 @@
const client = getClient() const client = getClient()
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const todayDate = new Date() let todayDate = new Date()
$: checkToday($ticker)
function checkToday (now: number): void {
if (!areDatesEqual(todayDate, new Date())) {
todayDate = new Date()
}
}
const ampm = new Intl.DateTimeFormat([], { hour: 'numeric' }).resolvedOptions().hour12 const ampm = new Intl.DateTimeFormat([], { hour: 'numeric' }).resolvedOptions().hour12
const getTimeFormat = (hour: number, min: number = 0): string => { const getTimeFormat = (hour: number, min: number = 0): string => {
if (min === 0) { if (min === 0) {