MCPcopy Index your code
hub / github.com/simstudioai/sim / getScheduleInfo

Function getScheduleInfo

apps/sim/lib/workflows/schedules/utils.ts:671–703  ·  view source on GitHub ↗
(
  cronExpression: string | null,
  nextRunAt: string | null,
  lastRanAt: string | null,
  scheduleType?: string | null,
  timezone?: string | null
)

Source from the content-addressed store, hash-verified

669 * Format schedule information for display
670 */
671export const getScheduleInfo = (
672 cronExpression: string | null,
673 nextRunAt: string | null,
674 lastRanAt: string | null,
675 scheduleType?: string | null,
676 timezone?: string | null
677): {
678 scheduleTiming: string
679 nextRunFormatted: string | null
680 lastRunFormatted: string | null
681} => {
682 if (!nextRunAt) {
683 return {
684 scheduleTiming: 'Unknown schedule',
685 nextRunFormatted: null,
686 lastRunFormatted: null,
687 }
688 }
689
690 let scheduleTiming = 'Unknown schedule'
691
692 if (cronExpression) {
693 scheduleTiming = parseCronToHumanReadable(cronExpression, timezone || undefined)
694 } else if (scheduleType) {
695 scheduleTiming = `${scheduleType.charAt(0).toUpperCase() + scheduleType.slice(1)}`
696 }
697
698 return {
699 scheduleTiming,
700 nextRunFormatted: formatDateTime(new Date(nextRunAt)),
701 lastRunFormatted: lastRanAt ? formatDateTime(new Date(lastRanAt)) : null,
702 }
703}

Callers

nothing calls this directly

Calls 2

formatDateTimeFunction · 0.90
parseCronToHumanReadableFunction · 0.85

Tested by

no test coverage detected