Skip to content

Event.clone() bypasses validation #8

@thedhanawada

Description

@thedhanawada

Problem

When you clone an event with updates using event.clone({ start: badValue }), the updates skip validation. This means you can create events with invalid data.

File: core/events/Event.js

What happens

const event = new Event({ title: 'Meeting', start: new Date() });
const cloned = event.clone({ start: 'not-a-date' }); // No error, bad data gets through

How to fix

Run the updates through normalizeEventData() before merging:

clone(updates = {}) {
  const normalizedUpdates = updates ? Event.normalizeEventData(updates) : {};
  return new Event({
    ...this.toJSON(),
    ...normalizedUpdates,
    id: undefined
  });
}

This ensures all updates are validated just like when creating a new event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions