The getCoords() method returns information about the current mouse cursor position relative to the Calendar grid.

Available since 2023.3.5726.

Declaration

DayPilot.Calendar.getCoords()

Return Value

Returns an object with the following properties:

  • x (number) - horizontal position in pixels

  • y (number) - vertical position in pixels

  • time (DayPilot.Date) - exact date/time at the current position

  • column (DayPilot.Column) - current column

  • alt (boolean) - Alt key pressed status (since 2026.2.6912)

  • ctrl (boolean) - Ctrl key pressed status (since 2026.2.6912)

  • shift (boolean) - Shift key pressed status (since 2026.2.6912)

  • meta (boolean) - Meta key pressed status (since 2026.2.6912)

Returns null if the current position cannot be read, for example when the mouse cursor is outside of the grid.

Example

const calendar = new DayPilot.Calendar("dp", {
  // ... config
});
calendar.init();

const coords = calendar.getCoords();

See Also

Availability

Availability of this API item in DayPilot editions:

ProductLitePro
DayPilot for JavaScript