Index | OAT homepage | OpenLink Software

# OATDOCcalendar

- OATDOCcalendar
- _ _ calendar.js
- _ _ _ _ Objects
- _ _ _ _ _ _ OAT.Calendar(optObj)
- _ _ _ _ Methods
- _ _ _ _ _ _ OAT.Calendar::show(x, y, callback, [date])
- _ _ _ _ Properties
- _ _ _ _ _ _ OAT.Calendar.dayNames
- _ _ _ _ _ _ OAT.Calendar.monthNames
- _ _ _ _ _ _ OAT.Calendar.specialDays
- _ _ _ _ _ _ OAT.Calendar.weekStartIndex
- _ _ _ _ _ _ OAT.Calendar.dayZeroIndex
- _ _ _ _ CSS classes
- _ _ _ _ _ _ .calendar
- _ _ _ _ _ _ .calendar_selected
- _ _ _ _ _ _ .calendar_special
- _ _ _ _ _ _ .calendar_year
- _ _ _ _ _ _ .calendar_month
- _ _ _ _ Example

## calendar.js

Displays a calendar for date picking.

### Objects

#### OAT.Calendar(optObj)

Instantiates the `OAT.Calendar` object. `optObj` may contain:

- `popup` - bool; should clicking anywhere close the calendar? (default: `false` )

### Methods

#### OAT.Calendar::show(x, y, callback, [date])

Shows the calendar. It will appear at `[x, y]` . If `date` is specified, it will be pre-selected. All dates are in form of `[year, month, day]` , starting from 1. When user selects a date, a `callback(date)` will be called.

### Properties

#### OAT.Calendar.dayNames

array of 7 day names

#### OAT.Calendar.monthNames

array of 12 month names

#### OAT.Calendar.specialDays

array specifying which days should be special (weekends)

#### OAT.Calendar.weekStartIndex

index of day (in `OAT.Calendar.dayNames` ) when week starts

#### OAT.Calendar.dayZeroIndex

index of day (in `OAT.Calendar.dayNames` ) for which `Date::getDay()` returns 0, i.e., "Sun".

### CSS classes

#### .calendar

CSS class of calendar div.

#### .calendar_selected

CSS class of previously selected day.

#### .calendar_special

CSS class of special days, e.g., Sundays, holidays.

#### .calendar_year

CSS class of div containing the year title and selection.

#### .calendar_month

CSS class of div containing the month title and selection.

### Example

    var c = new OAT.Calendar();
    c.dayNames = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];
    c.monthNames = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
    c.specialDays = [0,0,0,0,0,1,1];
    c.dayZeroIndex = 6;
    c.weekStartIndex = 6;
    c.show(100, 100, function(){});

Copyright (C) 2005-2008 OpenLink Software