Refactors date handling in calendar components
Updates event and column date parsing to use identifier instead of data attribute Improves date handling consistency across multiple calendar managers and renderers Replaces direct Date casting with dateService.parseISO() for more robust date parsing
This commit is contained in:
parent
8e52d670d6
commit
0f10d44037
3 changed files with 14 additions and 14 deletions
|
|
@ -102,7 +102,7 @@ export class DateEventRenderer implements IEventRenderer {
|
|||
public handleDragMove(payload: IDragMoveEventPayload): void {
|
||||
|
||||
const swpEvent = payload.draggedClone as SwpEventElement;
|
||||
const columnDate = this.dateService.parseISO(payload.columnBounds!!.data as Date);
|
||||
const columnDate = this.dateService.parseISO(payload.columnBounds!!.identifier);
|
||||
swpEvent.updatePosition(columnDate, payload.snappedY);
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ export class DateEventRenderer implements IEventRenderer {
|
|||
// Recalculate timestamps with new column date
|
||||
const currentTop = parseFloat(payload.draggedClone.style.top) || 0;
|
||||
const swpEvent = payload.draggedClone as SwpEventElement;
|
||||
const columnDate = this.dateService.parseISO(payload.newColumn.data as Date);
|
||||
const columnDate = this.dateService.parseISO(payload.newColumn.identifier);
|
||||
swpEvent.updatePosition(columnDate, currentTop);
|
||||
}
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ export class DateEventRenderer implements IEventRenderer {
|
|||
|
||||
console.log('🎯 DateEventRenderer: Converting all-day to timed event', {
|
||||
eventId: payload.calendarEvent.id,
|
||||
targetColumn: payload.targetColumn.data as Date,
|
||||
targetColumn: payload.targetColumn.identifier,
|
||||
snappedY: payload.snappedY
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ export class EventRenderingService {
|
|||
cloneElement.style.display = '';
|
||||
|
||||
console.log('🚪 EventRendererManager: Received drag:mouseleave-header', {
|
||||
targetDate,
|
||||
targetColumn: targetColumn?.identifier,
|
||||
originalElement: originalElement,
|
||||
cloneElement: cloneElement
|
||||
});
|
||||
|
|
@ -296,7 +296,7 @@ export class EventRenderingService {
|
|||
}
|
||||
|
||||
// Re-render target column if exists and different from source
|
||||
if (targetColumn && (targetColumn.data as Date) !== (originalSourceColumn?.data as Date)) {
|
||||
if (targetColumn && targetColumn.identifier !== originalSourceColumn?.identifier) {
|
||||
await this.renderSingleColumn(targetColumn);
|
||||
}
|
||||
}
|
||||
|
|
@ -317,7 +317,7 @@ export class EventRenderingService {
|
|||
*/
|
||||
private async renderSingleColumn(column: IColumnBounds): Promise<void> {
|
||||
// Get events for just this column's date
|
||||
const dateString = (column.data as Date).toISOString().split('T')[0];
|
||||
const dateString = column.identifier;
|
||||
const columnStart = this.dateService.parseISO(`${dateString}T00:00:00`);
|
||||
const columnEnd = this.dateService.parseISO(`${dateString}T23:59:59.999`);
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ export class EventRenderingService {
|
|||
}
|
||||
|
||||
console.log('🔄 EventRendererManager: Re-rendered single column', {
|
||||
columnDate: column.data as Date,
|
||||
columnDate: column.identifier,
|
||||
eventsCount: timedEvents.length
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue