Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(date-helper): rebuild the step forms around plain-language copy (#15281)

Talal Jaberd2b0b096695a
diff --git a/bun.lock b/bun.lock
index 5857f496cfd..a1ec9c4f088 100644
--- a/bun.lock
+++ b/bun.lock
@@ -10365,7 +10365,7 @@
},
"packages/pieces/core/date-helper": {
"name": "@activepieces/piece-date-helper",
- "version": "0.1.35",
+ "version": "0.1.36",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/core/date-helper/package.json b/packages/pieces/core/date-helper/package.json
index 950cf0c774b..c47c7fe10fa 100644
--- a/packages/pieces/core/date-helper/package.json
+++ b/packages/pieces/core/date-helper/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-date-helper",
- "version": "0.1.35",
+ "version": "0.1.36",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/core/date-helper/src/i18n/translation.json b/packages/pieces/core/date-helper/src/i18n/translation.json
index ff95d3f4244..ff9791e21d5 100644
--- a/packages/pieces/core/date-helper/src/i18n/translation.json
+++ b/packages/pieces/core/date-helper/src/i18n/translation.json
@@ -1,4 +1,5 @@
{
+ "1694949838": "1694949838",
"Manipulate, format, and extract time units for all your date and time needs.": "Manipulate, format, and extract time units for all your date and time needs.",
"Get Current Date": "Get Current Date",
"Format Date": "Format Date",
@@ -11,62 +12,58 @@
"Last Day of Previous Month": "Last Day of Previous Month",
"Get the current date": "Get the current date",
"Converts a date from one format to another": "Converts a date from one format to another",
- "Extract date units ( year , month , day , hour , minute , second , day of week , month name ) from a date": "Extract date units ( year , month , day , hour , minute , second , day of week , month name ) from a date",
+ "Pull year, month, day, weekday and more out of a date": "Pull year, month, day, weekday and more out of a date",
"Get the difference between two dates": "Get the difference between two dates",
"Add or subtract time from a date": "Add or subtract time from a date",
"Get the date and time of the next day of the week": "Get the date and time of the next day of the week",
"Get the date and time of the next day of the year": "Get the date and time of the next day of the year",
"Get the date and time of the first day of the previous month": "Get the date and time of the first day of the previous month",
"Get the date and time of the last day of the previous month": "Get the date and time of the last day of the previous month",
- "To Time Format": "To Time Format",
+ "Output Format": "Output Format",
"Time Zone": "Time Zone",
- "Input Date": "Input Date",
- "From Time Format": "From Time Format",
- "From Time Zone": "From Time Zone",
- "To Time Zone": "To Time Zone",
- "Unit to Extract": "Unit to Extract",
- "Starting Date": "Starting Date",
- "Starting date format": "Starting date format",
- "Ending Date": "Ending Date",
- "Ending date format": "Ending date format",
- "Unit": "Unit",
+ "Date": "Date",
+ "Format": "Format",
+ "Date Format": "Date Format",
+ "Units": "Units",
"Expression": "Expression",
- "Set Time To (24h format)": "Set Time To (24h format)",
+ "Set Time": "Set Time",
"Use Current Time": "Use Current Time",
"Weekday": "Weekday",
- "24h Time": "24h Time",
+ "Time": "Time",
"Month": "Month",
"Day of Month": "Day of Month",
- "Here's what each part of the format (e.g., YYYY) represents:\n\nYYYY : Year (4 digits) - Example: 2023\n\nYY : Year (2 digits) - Example: 23\n\nMMMM : Month (full name) - Example: September\n\nMMM : Month (short name) - Example: Sep\n\nMM : Month (2 digits) - Example: 09\n\nDDDD : Day (full name) - Example: Sunday\n\nDDD : Day (short name) - Example: Sun\n\nDD : Day (2 digits) - Example: 17\n\nHH : Hour (2 digits) - Example: 11\n\nmm : Minute (2 digits) - Example: 23\n\nss : Second (2 digits) - Example: 58\n\nX : Time in Unix form": "Here's what each part of the format (e.g., YYYY) represents:\n\nYYYY : Year (4 digits) - Example: 2023\n\nYY : Year (2 digits) - Example: 23\n\nMMMM : Month (full name) - Example: September\n\nMMM : Month (short name) - Example: Sep\n\nMM : Month (2 digits) - Example: 09\n\nDDDD : Day (full name) - Example: Sunday\n\nDDD : Day (short name) - Example: Sun\n\nDD : Day (2 digits) - Example: 17\n\nHH : Hour (2 digits) - Example: 11\n\nmm : Minute (2 digits) - Example: 23\n\nss : Second (2 digits) - Example: 58\n\nX : Time in Unix format - Example: 1694949838",
- "Enter the input date": "Enter the input date",
- "Select the unit to extract from the date": "Select the unit to extract from the date",
- "Enter the starting date": "Enter the starting date",
- "Enter the ending date": "Enter the ending date",
- "Select the unit of difference between the two dates": "Select the unit of difference between the two dates",
- "Provide an expression to add or subtract using the following units (year , month , day , hour , minute or second).\n \nExamples:\n+ 2 second + 1 hour \n+ 1 year - 3 day - 2 month \n+ 5 minute": "Provide an expression to add or subtract using the following units (year , month , day , hour , minute or second).\n \nExamples:\n+ 2 second + 1 hour \n+ 1 year - 3 day - 2 month \n+ 5 minute",
- "Optional: Set a timezone for the calculation to handle DST correctly": "Optional: Set a timezone for the calculation to handle DST correctly",
- "Optional: Set the result to a specific time (e.g., \"10:00\" or \"14:30\"). This allows scheduling at a specific time after adding/subtracting dates. Leave empty to keep the calculated time.": "Optional: Set the result to a specific time (e.g., \"10:00\" or \"14:30\"). This allows scheduling at a specific time after adding/subtracting dates. Leave empty to keep the calculated time.",
- "If checked, the current time will be used instead of the time from \"Set Time To\" field.": "If checked, the current time will be used instead of the time from \"Set Time To\" field.",
- "The weekday that you would like to get the date and time of.": "The weekday that you would like to get the date and time of.",
- "The time that you would like to get the date and time of. This must be in 24h format.": "The time that you would like to get the date and time of. This must be in 24h format.",
- "If checked, the current time will be used instead of the time specified above.": "If checked, the current time will be used instead of the time specified above.",
- "The month that you would like to get the date and time of.": "The month that you would like to get the date and time of.",
- "The day of the month that you would like to get the date and time of.": "The day of the month that you would like to get the date and time of.",
- "DDD MMM DD YYYY HH:mm:ss (Sun Sep 17 2023 11:23:58)": "DDD MMM DD YYYY HH:mm:ss (Sun Sep 17 2023 11:23:58)",
- "DDD MMM DD HH:mm:ss YYYY (Sun Sep 17 11:23:58 2023)": "DDD MMM DD HH:mm:ss YYYY (Sun Sep 17 11:23:58 2023)",
- "MMMM DD YYYY HH:mm:ss (September 17 2023 11:23:58)": "MMMM DD YYYY HH:mm:ss (September 17 2023 11:23:58)",
- "MMMM DD YYYY (September 17 2023)": "MMMM DD YYYY (September 17 2023)",
- "MMM DD YYYY (Sep 17 2023)": "MMM DD YYYY (Sep 17 2023)",
- "YYYY-MM-DDTHH:mm:ss (2023-09-17T11:23:58) ": "YYYY-MM-DDTHH:mm:ss (2023-09-17T11:23:58) ",
- "YYYY-MM-DD HH:mm:ss (2023-09-17 11:23:58)": "YYYY-MM-DD HH:mm:ss (2023-09-17 11:23:58)",
- "YYYY-MM-DD (2023-09-17)": "YYYY-MM-DD (2023-09-17)",
- "MM-DD-YYYY (09-17-2023)": "MM-DD-YYYY (09-17-2023)",
- "MM/DD/YYYY (09/17/2023)": "MM/DD/YYYY (09/17/2023)",
- "MM/DD/YY (09/17/23)": "MM/DD/YY (09/17/23)",
- "DD-MM-YYYY (17-09-2023)": "DD-MM-YYYY (17-09-2023)",
- "DD/MM/YYYY (17/09/2023)": "DD/MM/YYYY (17/09/2023)",
- "DD/MM/YY (17/09/23)": "DD/MM/YY (17/09/23)",
- "X (1694949838)": "X (1694949838)",
+ "Pick how the result should look.": "Pick how the result should look.",
+ "Time zone the current date and time are reported in.": "Time zone the current date and time are reported in.",
+ "Usually a value from a previous step, in the format below.": "Usually a value from a previous step, in the format below.",
+ "Pick how your date is written.": "Pick how your date is written.",
+ "Time zone the date above is written in.": "Time zone the date above is written in.",
+ "Time zone to convert the result to.": "Time zone to convert the result to.",
+ "Each unit becomes its own output field. Month is 1 to 12.": "Each unit becomes its own output field. Month is 1 to 12.",
+ "Each unit becomes its own output field, as remainders not totals.": "Each unit becomes its own output field, as remainders not totals.",
+ "Use year, month, day, hour, minute, second with + or -.": "Use year, month, day, hour, minute, second with + or -.",
+ "Needed for the two options below and for daylight-saving.": "Needed for the two options below and for daylight-saving.",
+ "Pin the result to this time of day, HH:mm. Needs a Time Zone.": "Pin the result to this time of day, HH:mm. Needs a Time Zone.",
+ "Pin the result to the current time instead. Needs a Time Zone.": "Pin the result to the current time instead. Needs a Time Zone.",
+ "The next date on this weekday. Today counts if the time is ahead.": "The next date on this weekday. Today counts if the time is ahead.",
+ "Time zone used to work out the date and to report the result.": "Time zone used to work out the date and to report the result.",
+ "24-hour clock, HH:mm.": "24-hour clock, HH:mm.",
+ "Ignore the Time field and use the current time of day.": "Ignore the Time field and use the current time of day.",
+ "Month of the date to find.": "Month of the date to find.",
+ "Rolls into the next month if the month is shorter.": "Rolls into the next month if the month is shorter.",
+ "Sun Sep 17 2023 11:23:58": "Sun Sep 17 2023 11:23:58",
+ "Sun Sep 17 11:23:58 2023": "Sun Sep 17 11:23:58 2023",
+ "September 17 2023 11:23:58": "September 17 2023 11:23:58",
+ "September 17 2023": "September 17 2023",
+ "Sep 17 2023": "Sep 17 2023",
+ "2023-09-17T11:23:58": "2023-09-17T11:23:58",
+ "2023-09-17 11:23:58": "2023-09-17 11:23:58",
+ "2023-09-17": "2023-09-17",
+ "09-17-2023": "09-17-2023",
+ "09/17/2023": "09/17/2023",
+ "09/17/23": "09/17/23",
+ "17-09-2023": "17-09-2023",
+ "17/09/2023": "17/09/2023",
+ "17/09/23": "17/09/23",
"(GMT-11:00) Pacific, Midway": "(GMT-11:00) Pacific, Midway",
"(GMT-11:00) Pacific, Niue": "(GMT-11:00) Pacific, Niue",
"(GMT-11:00) Pacific, Pago Pago": "(GMT-11:00) Pacific, Pago Pago",
@@ -492,7 +489,7 @@
"Minute": "Minute",
"Second": "Second",
"Day of Week": "Day of Week",
- "Month name": "Month name",
+ "Month Name": "Month Name",
"Sunday": "Sunday",
"Monday": "Monday",
"Tuesday": "Tuesday",
diff --git a/packages/pieces/core/date-helper/src/index.ts b/packages/pieces/core/date-helper/src/index.ts
index 06edbb764d7..f25c08f9140 100644
--- a/packages/pieces/core/date-helper/src/index.ts
+++ b/packages/pieces/core/date-helper/src/index.ts
@@ -15,7 +15,7 @@ const description = `Manipulate, format, and extract time units for all your dat
export const utilityDate = createPiece({
displayName: 'Date Helper',
auth: PieceAuth.None(),
- minimumSupportedRelease: '0.36.1',
+ minimumSupportedRelease: '0.88.2',
categories: [PieceCategory.CORE],
logoUrl: 'https://cdn.activepieces.com/pieces/new-core/date-helper.svg',
authors: [
diff --git a/packages/pieces/core/date-helper/src/lib/actions/add-subtract-date.ts b/packages/pieces/core/date-helper/src/lib/actions/add-subtract-date.ts
index 369e58e500c..560e08aa917 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/add-subtract-date.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/add-subtract-date.ts
@@ -6,7 +6,10 @@ import {
optionalTimeFormats,
parseDate,
timeFormat,
- timeFormatDescription,
+ inputFormatDescription,
+ outputFormatDescription,
+ dateInputDescription,
+ timeInputPlaceholder,
timeParts,
timeZoneOptions,
} from '../common';
@@ -21,54 +24,81 @@ export const addSubtractDateAction = createAction({
displayName: 'Add/Subtract Time',
description: 'Add or subtract time from a date',
aiMetadata: { description: 'Shifts an input date by a signed year/month/day/hour/minute/second expression, and can pin the resulting clock time to a fixed 24h value or the current time. Use Date Difference to compare two dates, Format Date for a format or zone change only, and Next Day of Week or Next Day of Year for the next calendar occurrence. The Set Time To (HH:mm) and Use Current Time options apply only when a Time Zone is also selected; idempotent except when Use Current Time ties the result to the clock.', idempotent: true },
+ propertyGroups: [
+ {
+ key: 'input',
+ display: 'section',
+ label: 'Input',
+ icon: 'calendar',
+ props: ['inputDate', 'inputDateFormat'],
+ },
+ {
+ key: 'shift',
+ display: 'section',
+ label: 'Shift',
+ icon: 'sliders',
+ props: ['expression'],
+ },
+ {
+ key: 'output',
+ display: 'section',
+ label: 'Output',
+ icon: 'type',
+ props: ['outputFormat'],
+ },
+ ],
props: {
inputDate: Property.ShortText({
- displayName: 'Input Date',
- description: 'Enter the input date',
+ displayName: 'Date',
+ description: dateInputDescription,
required: true,
}),
inputDateFormat: Property.StaticDropdown({
- displayName: 'From Time Format',
- description: timeFormatDescription,
+ displayName: 'Format',
+ description: inputFormatDescription,
options: {
options: optionalTimeFormats,
},
required: true,
- defaultValue: getCorrectedFormat(timeFormat.format00),
+ defaultValue: timeFormat.format00,
+ }),
+ expression: Property.LongText({
+ displayName: 'Expression',
+ placeholder: '+ 1 day - 2 hour',
+ description: 'Use year, month, day, hour, minute, second with + or -.',
+ required: true,
}),
outputFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
required: true,
- defaultValue: getCorrectedFormat(timeFormat.format00),
- }),
- expression: Property.LongText({
- displayName: 'Expression',
- description: `Provide an expression to add or subtract using the following units (year , month , day , hour , minute or second).
- \nExamples:\n+ 2 second + 1 hour \n+ 1 year - 3 day - 2 month \n+ 5 minute`,
- required: true,
+ defaultValue: timeFormat.format00,
}),
timeZone: Property.StaticDropdown<string>({
displayName: 'Time Zone',
- description: 'Optional: Set a timezone for the calculation to handle DST correctly',
+ description: 'Needed for the two options below and for daylight-saving.',
options: {
options: timeZoneOptions,
},
required: false,
+ advanced: true,
}),
setTime: Property.ShortText({
- displayName: 'Set Time To (24h format)',
- description: 'Optional: Set the result to a specific time (e.g., "10:00" or "14:30"). This allows scheduling at a specific time after adding/subtracting dates. Leave empty to keep the calculated time.',
+ displayName: 'Set Time',
+ description: 'Pin the result to this time of day, HH:mm. Needs a Time Zone.',
+ placeholder: timeInputPlaceholder,
required: false,
+ advanced: true,
}),
useCurrentTime: Property.Checkbox({
displayName: 'Use Current Time',
- description: 'If checked, the current time will be used instead of the time from "Set Time To" field.',
+ description: 'Pin the result to the current time instead. Needs a Time Zone.',
required: false,
defaultValue: false,
+ advanced: true,
}),
},
outputSchema: addSubtractDateActionOutputSchema,
diff --git a/packages/pieces/core/date-helper/src/lib/actions/date-difference.ts b/packages/pieces/core/date-helper/src/lib/actions/date-difference.ts
index 75aaf09bd9a..971f3f076eb 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/date-difference.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/date-difference.ts
@@ -3,7 +3,8 @@ import {
optionalTimeFormats,
timeFormat,
timeParts,
- timeFormatDescription,
+ inputFormatDescription,
+ dateInputDescription,
parseDate,
getCorrectedFormat,
apDayjs,
@@ -16,15 +17,31 @@ export const dateDifferenceAction = createAction({
displayName: 'Date Difference',
description: 'Get the difference between two dates',
aiMetadata: { description: 'Measures the elapsed time between a start date and an end date, returning any combination of the requested units in one call. Use it to compare two known dates for age, SLA or gap checks; use Add/Subtract Time instead to shift a single date. Each date needs its own input pattern, and the units are decomposed duration components rather than totals - the day value is the remainder inside the month - and come back negative when the end date precedes the start; read-only and idempotent.', idempotent: true },
+ propertyGroups: [
+ {
+ key: 'start',
+ display: 'section',
+ label: 'Start',
+ icon: 'calendar',
+ props: ['startDate', 'startDateFormat'],
+ },
+ {
+ key: 'end',
+ display: 'section',
+ label: 'End',
+ icon: 'calendar',
+ props: ['endDate', 'endDateFormat'],
+ },
+ ],
props: {
startDate: Property.ShortText({
- displayName: 'Starting Date',
- description: 'Enter the starting date',
+ displayName: 'Date',
+ description: dateInputDescription,
required: true,
}),
startDateFormat: Property.StaticDropdown({
- displayName: 'Starting date format',
- description: timeFormatDescription,
+ displayName: 'Format',
+ description: inputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -32,13 +49,13 @@ export const dateDifferenceAction = createAction({
defaultValue: timeFormat.format00,
}),
endDate: Property.ShortText({
- displayName: 'Ending Date',
- description: 'Enter the ending date',
+ displayName: 'Date',
+ description: dateInputDescription,
required: true,
}),
endDateFormat: Property.StaticDropdown({
- displayName: 'Ending date format',
- description: timeFormatDescription,
+ displayName: 'Format',
+ description: inputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -46,8 +63,8 @@ export const dateDifferenceAction = createAction({
defaultValue: timeFormat.format00,
}),
unitDifference: Property.StaticMultiSelectDropdown({
- displayName: 'Unit',
- description: 'Select the unit of difference between the two dates',
+ displayName: 'Units',
+ description: 'Each unit becomes its own output field, as remainders not totals.',
options: {
options: [
{ label: 'Year', value: timeParts.year },
@@ -59,7 +76,7 @@ export const dateDifferenceAction = createAction({
],
},
required: true,
- defaultValue: [timeParts.year],
+ defaultValue: [timeParts.day],
}),
},
async run(context) {
diff --git a/packages/pieces/core/date-helper/src/lib/actions/extract-date-parts.ts b/packages/pieces/core/date-helper/src/lib/actions/extract-date-parts.ts
index b96c2d6a4d9..98cfe2c5d70 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/extract-date-parts.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/extract-date-parts.ts
@@ -3,7 +3,8 @@ import {
optionalTimeFormats,
timeFormat,
timeParts,
- timeFormatDescription,
+ inputFormatDescription,
+ dateInputDescription,
parseDate,
getCorrectedFormat,
} from '../common';
@@ -13,18 +14,17 @@ export const extractDateParts = createAction({
name: 'extract_date_parts',
classification: 'READ',
displayName: 'Extract Date Units',
- description:
- 'Extract date units ( year , month , day , hour , minute , second , day of week , month name ) from a date',
+ description: 'Pull year, month, day, weekday and more out of a date',
aiMetadata: { description: 'Parses one date string and returns the selected calendar components as separate values, any combination in a single call, with month as a 1-12 number and the weekday and month names spelled out. Use it when downstream logic needs the parts as data, for example branching on the weekday name; prefer Format Date when you only need the whole date rendered differently. Requires the date and its input pattern, and each requested unit must come from that supported set or the action throws; read-only and idempotent.', idempotent: true },
props: {
inputDate: Property.ShortText({
- displayName: 'Input Date',
- description: 'Enter the input date',
+ displayName: 'Date',
+ description: dateInputDescription,
required: true,
}),
inputFormat: Property.StaticDropdown({
- displayName: 'From Time Format',
- description: timeFormatDescription,
+ displayName: 'Date Format',
+ description: inputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -32,8 +32,8 @@ export const extractDateParts = createAction({
defaultValue: timeFormat.format00,
}),
unitExtract: Property.StaticMultiSelectDropdown({
- displayName: 'Unit to Extract',
- description: 'Select the unit to extract from the date',
+ displayName: 'Units',
+ description: 'Each unit becomes its own output field. Month is 1 to 12.',
options: {
options: [
{ label: 'Year', value: timeParts.year },
@@ -43,11 +43,11 @@ export const extractDateParts = createAction({
{ label: 'Minute', value: timeParts.minute },
{ label: 'Second', value: timeParts.second },
{ label: 'Day of Week', value: timeParts.dayOfWeek },
- { label: 'Month name', value: timeParts.monthName },
+ { label: 'Month Name', value: timeParts.monthName },
],
},
required: true,
- defaultValue: [timeParts.year],
+ defaultValue: [timeParts.year, timeParts.month, timeParts.day],
}),
},
async run(context) {
diff --git a/packages/pieces/core/date-helper/src/lib/actions/first-day-of-prior-month.ts b/packages/pieces/core/date-helper/src/lib/actions/first-day-of-prior-month.ts
index 6a7250e456f..44cb6fb81a8 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/first-day-of-prior-month.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/first-day-of-prior-month.ts
@@ -2,7 +2,10 @@ import { Property, createAction } from '@activepieces/pieces-framework';
import {
optionalTimeFormats,
timeFormat,
- timeFormatDescription,
+ outputFormatDescription,
+ timeInputDescription,
+ timeInputPlaceholder,
+ useCurrentTimeDescription,
timeZoneOptions,
getCorrectedFormat,
apDayjs,
@@ -19,23 +22,9 @@ export const firstDayOfPreviousMonthAction = createAction({
description: 'Get the date and time of the first day of the previous month',
aiMetadata: { description: 'Returns the first calendar day of the month before the current month, stamped with midnight, a supplied 24h time, or the current time. Use it as the opening bound of a last-month reporting window, paired with Last Day of Previous Month; use Add/Subtract Time for an arbitrary offset from a specific date. Time zone and output format are required and the time must be HH:mm; not idempotent - the window is derived from the current clock and changes once the month rolls over.', idempotent: false },
props: {
- time: Property.ShortText({
- displayName: '24h Time',
- description:
- 'The time that you would like to get the date and time of. This must be in 24h format.',
- required: false,
- defaultValue: '00:00',
- }),
- currentTime: Property.Checkbox({
- displayName: 'Use Current Time',
- description:
- 'If checked, the current time will be used instead of the time specified above.',
- required: false,
- defaultValue: false,
- }),
timeFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Output Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -44,12 +33,28 @@ export const firstDayOfPreviousMonthAction = createAction({
}),
timeZone: Property.StaticDropdown<string>({
displayName: 'Time Zone',
+ description:
+ 'Time zone used to work out the date and to report the result.',
options: {
options: timeZoneOptions,
},
required: true,
defaultValue: 'UTC',
}),
+ time: Property.ShortText({
+ displayName: 'Time',
+ description: timeInputDescription,
+ placeholder: timeInputPlaceholder,
+ required: false,
+ defaultValue: '00:00',
+ }),
+ currentTime: Property.Checkbox({
+ displayName: 'Use Current Time',
+ description: useCurrentTimeDescription,
+ required: false,
+ defaultValue: false,
+ advanced: true,
+ }),
},
outputSchema: firstDayOfPreviousMonthActionOutputSchema,
async run(context) {
diff --git a/packages/pieces/core/date-helper/src/lib/actions/format-date.ts b/packages/pieces/core/date-helper/src/lib/actions/format-date.ts
index bc03613c413..b5f72db9ec3 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/format-date.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/format-date.ts
@@ -3,7 +3,9 @@ import {
optionalTimeFormats,
parseDate,
timeFormat,
- timeFormatDescription,
+ inputFormatDescription,
+ outputFormatDescription,
+ dateInputDescription,
timeZoneOptions,
getCorrectedFormat,
} from '../common';
@@ -16,15 +18,31 @@ export const formatDateAction = createAction({
displayName: 'Format Date',
description: 'Converts a date from one format to another',
aiMetadata: { description: 'Converts a date string from one pattern and time zone into another in a single step. Pick this for a pure representation change; use Extract Date Units to pull components as data, Add/Subtract Time to move the date, and Date Difference to compare two dates. Requires the input date plus source and target format and zone; the source pattern is only a parsing hint (parsing falls back to lenient then native parsing) and the action throws if the value cannot be parsed at all, but is otherwise deterministic and idempotent.', idempotent: true },
+ propertyGroups: [
+ {
+ key: 'input',
+ display: 'section',
+ label: 'Input',
+ icon: 'calendar',
+ props: ['inputDate', 'inputFormat', 'inputTimeZone'],
+ },
+ {
+ key: 'output',
+ display: 'section',
+ label: 'Output',
+ icon: 'type',
+ props: ['outputFormat', 'outputTimeZone'],
+ },
+ ],
props: {
inputDate: Property.ShortText({
- displayName: 'Input Date',
- description: 'Enter the input date',
+ displayName: 'Date',
+ description: dateInputDescription,
required: true,
}),
inputFormat: Property.StaticDropdown({
- displayName: 'From Time Format',
- description: timeFormatDescription,
+ displayName: 'Format',
+ description: inputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -32,7 +50,8 @@ export const formatDateAction = createAction({
defaultValue: timeFormat.format00,
}),
inputTimeZone: Property.StaticDropdown<string>({
- displayName: 'From Time Zone',
+ displayName: 'Time Zone',
+ description: 'Time zone the date above is written in.',
options: {
options: timeZoneOptions,
},
@@ -40,8 +59,8 @@ export const formatDateAction = createAction({
defaultValue: 'UTC',
}),
outputFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -49,7 +68,8 @@ export const formatDateAction = createAction({
defaultValue: timeFormat.format00,
}),
outputTimeZone: Property.StaticDropdown<string>({
- displayName: 'To Time Zone',
+ displayName: 'Time Zone',
+ description: 'Time zone to convert the result to.',
options: {
options: timeZoneOptions,
},
diff --git a/packages/pieces/core/date-helper/src/lib/actions/get-current-date.ts b/packages/pieces/core/date-helper/src/lib/actions/get-current-date.ts
index 509f9205d37..f214a44f7ea 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/get-current-date.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/get-current-date.ts
@@ -2,7 +2,7 @@ import { Property, createAction } from '@activepieces/pieces-framework';
import {
optionalTimeFormats,
timeFormat,
- timeFormatDescription,
+ outputFormatDescription,
timeZoneOptions,
getCorrectedFormat,
apDayjs
@@ -18,8 +18,8 @@ export const getCurrentDate = createAction({
aiMetadata: { description: 'Reads the clock and returns the current date and time for a chosen IANA time zone, rendered with one of 15 preset patterns (including unix seconds via X). Use it to stamp a run with the current instant or to produce the base date that Format Date, Add/Subtract Time or Date Difference consume; it accepts no date input, so prefer Format Date when you already have a date string. Output format and time zone are both required; not idempotent, since every call reads the clock and returns a different value.', idempotent: false },
props: {
timeFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Output Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -28,6 +28,7 @@ export const getCurrentDate = createAction({
}),
timeZone: Property.StaticDropdown<string>({
displayName: 'Time Zone',
+ description: 'Time zone the current date and time are reported in.',
options: {
options: timeZoneOptions,
},
diff --git a/packages/pieces/core/date-helper/src/lib/actions/last-day-of-prior-month.ts b/packages/pieces/core/date-helper/src/lib/actions/last-day-of-prior-month.ts
index 4539636292b..d48d0f317af 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/last-day-of-prior-month.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/last-day-of-prior-month.ts
@@ -2,7 +2,10 @@ import { Property, createAction } from '@activepieces/pieces-framework';
import {
optionalTimeFormats,
timeFormat,
- timeFormatDescription,
+ outputFormatDescription,
+ timeInputDescription,
+ timeInputPlaceholder,
+ useCurrentTimeDescription,
timeZoneOptions,
getCorrectedFormat,
apDayjs,
@@ -19,23 +22,9 @@ export const lastDayOfPreviousMonthAction = createAction({
description: 'Get the date and time of the last day of the previous month',
aiMetadata: { description: 'Returns the last calendar day of the month before the current month, stamped with midnight, a supplied 24h time, or the current time - the time is overwritten rather than set to end of day, so 23:59 must be asked for explicitly. Use it as the closing bound of a last-month reporting window whose start comes from First Day of Previous Month. Time zone and output format are required and the time must be HH:mm; not idempotent - derived from the current clock, changing once the month rolls over.', idempotent: false },
props: {
- time: Property.ShortText({
- displayName: '24h Time',
- description:
- 'The time that you would like to get the date and time of. This must be in 24h format.',
- required: false,
- defaultValue: '00:00',
- }),
- currentTime: Property.Checkbox({
- displayName: 'Use Current Time',
- description:
- 'If checked, the current time will be used instead of the time specified above.',
- required: false,
- defaultValue: false,
- }),
timeFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Output Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -44,12 +33,28 @@ export const lastDayOfPreviousMonthAction = createAction({
}),
timeZone: Property.StaticDropdown<string>({
displayName: 'Time Zone',
+ description:
+ 'Time zone used to work out the date and to report the result.',
options: {
options: timeZoneOptions,
},
required: true,
defaultValue: 'UTC',
}),
+ time: Property.ShortText({
+ displayName: 'Time',
+ description: timeInputDescription,
+ placeholder: timeInputPlaceholder,
+ required: false,
+ defaultValue: '00:00',
+ }),
+ currentTime: Property.Checkbox({
+ displayName: 'Use Current Time',
+ description: useCurrentTimeDescription,
+ required: false,
+ defaultValue: false,
+ advanced: true,
+ }),
},
outputSchema: lastDayOfPreviousMonthActionOutputSchema,
async run(context) {
diff --git a/packages/pieces/core/date-helper/src/lib/actions/next-day-of-week.ts b/packages/pieces/core/date-helper/src/lib/actions/next-day-of-week.ts
index c36f4838b23..cf7186d4e9d 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/next-day-of-week.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/next-day-of-week.ts
@@ -5,7 +5,10 @@ import {
import {
optionalTimeFormats,
timeFormat,
- timeFormatDescription,
+ outputFormatDescription,
+ timeInputDescription,
+ timeInputPlaceholder,
+ useCurrentTimeDescription,
timeZoneOptions,
getCorrectedFormat,
apDayjs,
@@ -25,7 +28,7 @@ export const nextDayofWeek = createAction({
weekday: Property.StaticDropdown({
displayName: 'Weekday',
description:
- 'The weekday that you would like to get the date and time of.',
+ 'The next date on this weekday. Today counts if the time is ahead.',
options: {
options: [
{ label: 'Sunday', value: 0 },
@@ -38,24 +41,11 @@ export const nextDayofWeek = createAction({
],
},
required: true,
- }),
- time: Property.ShortText({
- displayName: '24h Time',
- description:
- 'The time that you would like to get the date and time of. This must be in 24h format.',
- required: false,
- defaultValue: '00:00',
- }),
- currentTime: Property.Checkbox({
- displayName: 'Use Current Time',
- description:
- 'If checked, the current time will be used instead of the time specified above.',
- required: false,
- defaultValue: false,
+ defaultValue: 1,
}),
timeFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Output Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -64,12 +54,28 @@ export const nextDayofWeek = createAction({
}),
timeZone: Property.StaticDropdown<string>({
displayName: 'Time Zone',
+ description:
+ 'Time zone used to work out the date and to report the result.',
options: {
options: timeZoneOptions,
},
required: true,
defaultValue: 'UTC',
}),
+ time: Property.ShortText({
+ displayName: 'Time',
+ description: timeInputDescription,
+ placeholder: timeInputPlaceholder,
+ required: false,
+ defaultValue: '00:00',
+ }),
+ currentTime: Property.Checkbox({
+ displayName: 'Use Current Time',
+ description: useCurrentTimeDescription,
+ required: false,
+ defaultValue: false,
+ advanced: true,
+ }),
},
outputSchema: nextDayOfWeekActionOutputSchema,
async run(context) {
diff --git a/packages/pieces/core/date-helper/src/lib/actions/next-day-of-year.ts b/packages/pieces/core/date-helper/src/lib/actions/next-day-of-year.ts
index 2fe4d8e3d8f..6283dc9c7c9 100644
--- a/packages/pieces/core/date-helper/src/lib/actions/next-day-of-year.ts
+++ b/packages/pieces/core/date-helper/src/lib/actions/next-day-of-year.ts
@@ -5,7 +5,10 @@ import {
import {
optionalTimeFormats,
timeFormat,
- timeFormatDescription,
+ outputFormatDescription,
+ timeInputDescription,
+ timeInputPlaceholder,
+ useCurrentTimeDescription,
timeZoneOptions,
getCorrectedFormat,
apDayjs,
@@ -24,7 +27,7 @@ export const nextDayofYear = createAction({
props: {
month: Property.StaticDropdown({
displayName: 'Month',
- description: 'The month that you would like to get the date and time of.',
+ description: 'Month of the date to find.',
options: {
options: [
{ label: 'January', value: 1 },
@@ -46,27 +49,17 @@ export const nextDayofYear = createAction({
day: Property.Number({
displayName: 'Day of Month',
description:
- 'The day of the month that you would like to get the date and time of.',
+ 'Rolls into the next month if the month is shorter.',
required: true,
defaultValue: 1,
- }),
- time: Property.ShortText({
- displayName: '24h Time',
- description:
- 'The time that you would like to get the date and time of. This must be in 24h format.',
- required: false,
- defaultValue: '00:00',
- }),
- currentTime: Property.Checkbox({
- displayName: 'Use Current Time',
- description:
- 'If checked, the current time will be used instead of the time specified above.',
- required: false,
- defaultValue: false,
+ display: 'stepper',
+ min: 1,
+ max: 31,
+ step: 1,
}),
timeFormat: Property.StaticDropdown({
- displayName: 'To Time Format',
- description: timeFormatDescription,
+ displayName: 'Output Format',
+ description: outputFormatDescription,
options: {
options: optionalTimeFormats,
},
@@ -75,12 +68,28 @@ export const nextDayofYear = createAction({
}),
timeZone: Property.StaticDropdown<string>({
displayName: 'Time Zone',
+ description:
+ 'Time zone used to work out the date and to report the result.',
options: {
options: timeZoneOptions,
},
required: true,
defaultValue: 'UTC',
}),
+ time: Property.ShortText({
+ displayName: 'Time',
+ description: timeInputDescription,
+ placeholder: timeInputPlaceholder,
+ required: false,
+ defaultValue: '00:00',
+ }),
+ currentTime: Property.Checkbox({
+ displayName: 'Use Current Time',
+ description: useCurrentTimeDescription,
+ required: false,
+ defaultValue: false,
+ advanced: true,
+ }),
},
outputSchema: nextDayOfYearActionOutputSchema,
async run(context) {
diff --git a/packages/pieces/core/date-helper/src/lib/common/index.ts b/packages/pieces/core/date-helper/src/lib/common/index.ts
index 8226792f4dc..ae6cdf4fbc5 100644
--- a/packages/pieces/core/date-helper/src/lib/common/index.ts
+++ b/packages/pieces/core/date-helper/src/lib/common/index.ts
@@ -46,22 +46,22 @@ export enum timeFormat {
format14 = 'X',
}
-export enum timeFormatLabel {
- format00 = 'DDD MMM DD YYYY HH:mm:ss (Sun Sep 17 2023 11:23:58)',
- format01 = 'DDD MMM DD HH:mm:ss YYYY (Sun Sep 17 11:23:58 2023)',
- format02 = 'MMMM DD YYYY HH:mm:ss (September 17 2023 11:23:58)',
- format03 = 'MMMM DD YYYY (September 17 2023)',
- format04 = 'MMM DD YYYY (Sep 17 2023)',
- format05 = 'YYYY-MM-DDTHH:mm:ss (2023-09-17T11:23:58) ',
- format06 = 'YYYY-MM-DD HH:mm:ss (2023-09-17 11:23:58)',
- format07 = 'YYYY-MM-DD (2023-09-17)',
- format08 = 'MM-DD-YYYY (09-17-2023)',
- format09 = 'MM/DD/YYYY (09/17/2023)',
- format10 = 'MM/DD/YY (09/17/23)',
- format11 = 'DD-MM-YYYY (17-09-2023)',
- format12 = 'DD/MM/YYYY (17/09/2023)',
- format13 = 'DD/MM/YY (17/09/23)',
- format14 = 'X (1694949838)',
+export enum timeFormatExample {
+ format00 = 'Sun Sep 17 2023 11:23:58',
+ format01 = 'Sun Sep 17 11:23:58 2023',
+ format02 = 'September 17 2023 11:23:58',
+ format03 = 'September 17 2023',
+ format04 = 'Sep 17 2023',
+ format05 = '2023-09-17T11:23:58',
+ format06 = '2023-09-17 11:23:58',
+ format07 = '2023-09-17',
+ format08 = '09-17-2023',
+ format09 = '09/17/2023',
+ format10 = '09/17/23',
+ format11 = '17-09-2023',
+ format12 = '17/09/2023',
+ format13 = '17/09/23',
+ format14 = '1694949838',
}
@@ -102,36 +102,93 @@ export function parseDate(date: string, format: string): dayjs.Dayjs {
}
return djs;
}
-export const timeFormatDescription = `Here's what each part of the format (e.g., YYYY) represents:
-\nYYYY : Year (4 digits) - Example: 2023
-\nYY : Year (2 digits) - Example: 23
-\nMMMM : Month (full name) - Example: September
-\nMMM : Month (short name) - Example: Sep
-\nMM : Month (2 digits) - Example: 09
-\nDDDD : Day (full name) - Example: Sunday
-\nDDD : Day (short name) - Example: Sun
-\nDD : Day (2 digits) - Example: 17
-\nHH : Hour (2 digits) - Example: 11
-\nmm : Minute (2 digits) - Example: 23
-\nss : Second (2 digits) - Example: 58
-\nX : Time in Unix format - Example: 1694949838`;
+export const inputFormatDescription =
+ 'Pick how your date is written.';
+export const outputFormatDescription =
+ 'Pick how the result should look.';
+export const dateInputDescription =
+ 'Usually a value from a previous step, in the format below.';
+export const timeInputDescription = '24-hour clock, HH:mm.';
+export const timeInputPlaceholder = '14:30';
+export const useCurrentTimeDescription =
+ 'Ignore the Time field and use the current time of day.';
export const optionalTimeFormats = [
- { label: timeFormatLabel.format00, value: timeFormat.format00 },
- { label: timeFormatLabel.format01, value: timeFormat.format01 },
- { label: timeFormatLabel.format02, value: timeFormat.format02 },
- { label: timeFormatLabel.format03, value: timeFormat.format03 },
- { label: timeFormatLabel.format04, value: timeFormat.format04 },
- { label: timeFormatLabel.format05, value: timeFormat.format05 },
- { label: timeFormatLabel.format06, value: timeFormat.format06 },
- { label: timeFormatLabel.format07, value: timeFormat.format07 },
- { label: timeFormatLabel.format08, value: timeFormat.format08 },
- { label: timeFormatLabel.format09, value: timeFormat.format09 },
- { label: timeFormatLabel.format10, value: timeFormat.format10 },
- { label: timeFormatLabel.format11, value: timeFormat.format11 },
- { label: timeFormatLabel.format12, value: timeFormat.format12 },
- { label: timeFormatLabel.format13, value: timeFormat.format13 },
- { label: timeFormatLabel.format14, value: timeFormat.format14 },
+ {
+ label: timeFormatExample.format00,
+ value: timeFormat.format00,
+ description: timeFormat.format00,
+ },
+ {
+ label: timeFormatExample.format01,
+ value: timeFormat.format01,
+ description: timeFormat.format01,
+ },
+ {
+ label: timeFormatExample.format02,
+ value: timeFormat.format02,
+ description: timeFormat.format02,
+ },
+ {
+ label: timeFormatExample.format03,
+ value: timeFormat.format03,
+ description: timeFormat.format03,
+ },
+ {
+ label: timeFormatExample.format04,
+ value: timeFormat.format04,
+ description: timeFormat.format04,
+ },
+ {
+ label: timeFormatExample.format05,
+ value: timeFormat.format05,
+ description: timeFormat.format05,
+ },
+ {
+ label: timeFormatExample.format06,
+ value: timeFormat.format06,
+ description: timeFormat.format06,
+ },
+ {
+ label: timeFormatExample.format07,
+ value: timeFormat.format07,
+ description: timeFormat.format07,
+ },
+ {
+ label: timeFormatExample.format08,
+ value: timeFormat.format08,
+ description: timeFormat.format08,
+ },
+ {
+ label: timeFormatExample.format09,
+ value: timeFormat.format09,
+ description: timeFormat.format09,
+ },
+ {
+ label: timeFormatExample.format10,
+ value: timeFormat.format10,
+ description: timeFormat.format10,
+ },
+ {
+ label: timeFormatExample.format11,
+ value: timeFormat.format11,
+ description: timeFormat.format11,
+ },
+ {
+ label: timeFormatExample.format12,
+ value: timeFormat.format12,
+ description: timeFormat.format12,
+ },
+ {
+ label: timeFormatExample.format13,
+ value: timeFormat.format13,
+ description: timeFormat.format13,
+ },
+ {
+ label: timeFormatExample.format14,
+ value: timeFormat.format14,
+ description: 'X (Unix timestamp)',
+ },
];
export const timeZoneOptions = [