Rootless

Automate iOS, iPadOS, and macOS using plain JavaScript. Build custom widgets and interact directly with native APIs.

Download on the App Store
Rootless app interface

Plain JavaScript

Supports ES6. Scripts are stored as plain .js files on your disk.

Native APIs & Documentation

Integrate directly with iOS native APIs. Fully documented, available offline.

Siri Shortcuts

Trigger scripts via Siri. Present tables, websites, and custom HTML natively.

System Integration

Run from the Share Sheet, process inputs, and manage local files via Files.app.

x-callback-url

Communicate seamlessly and trigger workflows with other apps on your device.

Customizable & Ready

Tailor the code editor to your liking. Includes several example scripts to start immediately.

Documentation

Also inside the app, or as rootless.json.

DateTime

Date and time creation, parsing, and manipulation

Dates and times. Static methods make one, instance methods compare, format and do arithmetic.

Properties

yearNumber

Year component

monthNumber

Month component (1-12)

dayNumber

Day of month

hourNumber

Hour component (0-23)

minuteNumber

Minute component (0-59)

secondNumber

Second component (0-59)

weekdayString

Day name ("sunday" to "saturday")

Methods

.format(pattern)String

Format this date using a pattern (e.g. 'yyyy-MM-dd HH:mm').

  • pattern String required
.relative()String

Get a relative time string (e.g. '2 hours ago').

.isBefore(other)Boolean

Check if this date is before another.

.isAfter(other)Boolean

Check if this date is after another.

.isSameDay(other)Boolean

Check if this date is the same day as another.

.add(duration)DateTime ›

Add a duration to this date.

.subtract(duration)DateTime ›

Subtract a duration from this date.

.difference(other)Duration ›

Get the duration between this date and another.

.countdown(options?)LiveText

Time left until this date, counting down live on the Home Screen and stopping at 0:00. Hand the result to Text(). Measured from now unless from says otherwise.

  • options Any
    • from DateTime | Date | number

      Where the countdown started. Defaults to when the script runs; must be before this date.

    • pausedAt DateTime | Date | number

      Hold the display at the value it had at this moment. Clamped into the interval.

    • showsHours Boolean

      False shows 90:00 rather than 1:30:00. Default true.

.elapsed(options?)LiveText

Time since this date, counting up live on the Home Screen. Hand the result to Text(). The date must not be in the future; countdown() is for that.

  • options Any
    • until DateTime | Date | number

      Where it stops. Left out, it counts on.

    • pausedAt DateTime | Date | number

      Hold the display at the value it had at this moment. Clamped into the interval.

    • showsHours Boolean

      False shows 90:00 rather than 1:30:00. Default true.

.timer()LiveText

Counts down to this date and then up from it, live on the Home Screen: 12:00 before a meeting, 3:45 once it is under way. Hand the result to Text(). No options; for a countdown that stops at zero, or one you can pause, use countdown().

.offset()LiveText

The signed distance to now, live: "+2 hours" before this date, "-5 minutes" after it. Hand the result to Text(). For a frozen "2 hours ago", use relative().

DateTime.now()DateTime ›

Get the current date and time.

DateTime.today()DateTime ›

Get today's date at midnight.

DateTime.parse(isoString)DateTime ›

Parse an ISO 8601 date string.

  • isoString String required
DateTime.from(options)DateTime ›

Create a date from components: { year, month, day, hour, minute, second }. Also takes a number of epoch seconds, or a JS Date.

  • options Any required

    Anything left out defaults to the current value for that component.

    • year Number

      Defaults to the current year.

    • month Number

      1 to 12.

    • day Number

      1 to 31.

    • hour Number

      0 to 23.

    • minute Number

      0 to 59.

    • second Number

      0 to 59.

Examples

Current date & formatting

const now = DateTime.now();
const formatted = now.format("MMM d, yyyy");
// "Mar 13, 2026"

Parsing & comparison

const date = DateTime.parse("2026-01-01");
const today = DateTime.today();
console.log(date.isBefore(today)); // true

Date arithmetic

const tomorrow = DateTime.now()
  .add(Duration.days(1));
const diff = tomorrow.difference(DateTime.now());
console.log(diff.inHours); // ~24

A countdown that stops at zero

var end = DateTime.now().add(Duration.minutes(25));
Text(end.countdown(), { font: Font.system(40, FontWeight.bold) })

A paused timer

// Held at the value it had when it was paused, until the next run.
Text(end.countdown({ from: start, pausedAt: pausedAt }))

Time since an event

Text(startedAt.elapsed(), { color: Color.secondaryLabel() })