DateTime field

Combined date + time picker. Stores a full ISO 8601 timestamp in SharePoint.

The DateTime field combines a date picker with a time picker. The value is stored as an ISO 8601 timestamp in the SharePoint DateTime column (configured as Date & Time).

For date-only values use Date; for time-only values use Time.

Common properties

PropertyDescription
label
string
Visible label.
description
string
Helper text.
required
boolean
default: false
Marks the field required.
readOnly
boolean
default: false
Disables editing.

Type-specific properties

PropertyDescription
defaultValue
string
Value pre-populated on form-load. Accepts an ISO 8601 timestamp or the literal tokens [Today] / [Now], resolved at load time.

JavaScript recipes

Read the value as a Date

const raw = f365.field('StartsAt').value; // ISO 8601 string | null
const when = f365.format.parseDate(raw); // Date | null

Default to now when empty

f365.events.onLoad(() => {
  if (!f365.field('StartsAt').value) {
    f365.field('StartsAt').value = new Date().toISOString();
  }
});

Mirror a formatted copy into a label

f365.events.onChange((e) => {
  if (e.fieldKey !== 'StartsAt') return;
  const d = f365.format.parseDate(e.newValue);
  f365.field('StartsAtDisplay').value = d
    ? f365.format.datetime(d, { dateStyle: 'medium', timeStyle: 'short' })
    : '';
});

Block past timestamps on save

f365.events.onBeforeSave(() => {
  const d = f365.format.parseDate(f365.field('StartsAt').value);
  if (d && d.getTime() < Date.now()) {
    f365.ui.showToast('Start time must be in the future.', 'error');
    return false; // cancels the save
  }
  return true;
});

Related articles

  • Date field

    Date picker with calendar UI, configurable min/max range, locale-aware formatting, and optional time component.

  • Time field

    A time-only picker, hours, minutes, optional seconds. Stored as a string in SharePoint.