Calendar

The Calendar class contains properties, and functions for manipulating JavaScript date objects. This class supported by OmniGraffle, OmniFocus, OmniOutliner, and OmniPlan.

Class Properties

Instance Properties

Properties of an instance of the Calendar class:

Calendar.current.locale

Instance Functions

The available functions for an instance of the Calendar class:

var now = new Date() today = Calendar.current.startOfDay(now)

DateComponents Class

The DateComponents class represents the elements that comprise a date, such as day, hour, year, and minute.

Constructors

Instance Properties

The properties of an instance of the DateComponents class:

var date = new Date() var dc = Calendar.current.dateComponentsFromDate(date) dc.month + "/" + dc.day + "/" + dc.year
dc = new DateComponents() dc.month = 12 dc.day = 31 dc.year = 2019 date = Calendar.current.dateFromDateComponents(dc)
startDate = new Date("8/1/2019") endDate = new Date("10/15/2019") result = Calendar.current.dateComponentsBetweenDates(startDate, endDate) result.month result.day
now = new Date() today = Calendar.current.startOfDay(now) duration = new DateComponents() duration.day = 45 duration.hour = 17 targetDate = Calendar.current.dateByAddingDateComponents(today,duration)

TimeZone Class

Objects that represent a time zone.

Class Properties

The properties of the TimeZone class:

  • abbreviations (Array of String r/o) • The list of known time zone abbreviations.

TimeZone.abbreviations

Constructors

  • new TimeZone(abbreviation:String) → (TimeZone) • Make a new TimeZone with the given abbreviation. Note that the returned TimeZone may have a different abbreviation than the passed argument. For example, if one of "PST" or "PDT" is requested that doens't match the current use of daylight savings time, the one that does match will be returned.

Instance Properties

The properties of an instance of the TimeZone class:

  • abbreviation (String or null r/o) • The abbreviation for the TimeZone.

  • daylightSavingTime (Boolean r/o) • Returns true if the TimeZone is currently using daylight savings time.

  • secondsFromGMT (Number r/o) • The current difference in seconds between this TimeZone and GMT.

tzone = new TimeZone("PST") tzone.daylightSavingTime

Locale Class

Objects that represent a locale.

Class Properties

The properties of the Locale class:

  • identifiers (Array of String r/o) • The list of known ISO locale identifiers.

Locale.identifiers

Constructors

  • new Locale(identifier:String) → (Locale) • Make a new Locale with the given identifier.

Instance Properties

The properties of an instance of the Locale class:

  • calendar (Calendar r/o) • The calendar instance associated with the locale.

  • identifier (String r/o) • The unique identifier string for the locale.

  • currencyCode (String or null r/o) • The currency code for the locale.

loc = new Locale("en_US") loc.calendar

Using the currencyCode property of the Locale class to retrieve the currency code for Sweden:

new Locale("sv_SE").currencyCode

Reference Links

UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER