Skip to content

[5761] Enhance macro support for populating dates and times in the date time picker#4864

Open
jvega190 wants to merge 7 commits into
craftercms:developfrom
jvega190:enhancement/5761
Open

[5761] Enhance macro support for populating dates and times in the date time picker#4864
jvega190 wants to merge 7 commits into
craftercms:developfrom
jvega190:enhancement/5761

Conversation

@jvega190

@jvega190 jvega190 commented May 19, 2026

Copy link
Copy Markdown
Member

craftercms/craftercms#5761

Summary by CodeRabbit

  • New Features
    • Expanded date macro support in form population expressions: full and abbreviated day-of-week macros, now with ± offsets (days/weeks/years/hours/minutes), and optional static time (HH:mm or HH:mm:ss).
  • Bug Fixes
    • Improved validation and parsing of date/time expressions, with invalid inputs now safely falling back to the current date (with sensible clamping when applicable).
  • Documentation
    • Refreshed date/time input help text to show separate guidance for offset-style versus day-based formats, plus updated examples.

@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@jvega190, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 4 minutes. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1535671b-bf4a-4a2a-8033-a93c4377c873

📥 Commits

Reviewing files that changed from the base of the PR and between cddca3e and a413b8c.

📒 Files selected for processing (2)
  • ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx
  • ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

Walkthrough

The PR expands date-populate expression support in the forms engine by enhancing validation to recognize day-of-week macros, extended now-expressions with multiple time units, and {macro} patterns with optional static times, then refactoring the computation logic to resolve these new formats using helper functions for day-of-week calculations and time application. The help text in DateTimeExpressionInput is updated to document these new formats separately.

Changes

Date populate-expression macro expansion

Layer / File(s) Summary
Macro validation and date helpers
ui/app/src/components/FormsEngine/lib/controlHelpers.tsx
Validation function expanded to recognize day-of-week macros (full and abbreviated), now expressions with extended units (d|days|w|weeks|y|years|h|hours|m|minutes), and {macro} patterns optionally followed by validated static times in HH:mm or HH:mm:ss format. New helper functions getNextDayOfWeek and setTimeOnDate added to compute next day-of-week occurrences and apply static times to dates.
Date expression computation
ui/app/src/components/FormsEngine/lib/controlHelpers.tsx
processPopulateExpression refactored to parse {macro} expressions with optional static times, dispatch day-of-week macros to getNextDayOfWeek, validate and apply now/now±N(unit) adjustments (including allowPastDate logic), and apply optional static times using setTimeOnDate.
Help text and UI documentation
ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx
Format constants split from single DATE_TIME_FORMAT into DATE_TIME_FORMAT_OFFSET and DATE_TIME_FORMAT_DAY with updated DATE_TIME_EXAMPLE. Tooltip help text refactored to render separate guidance blocks for offset-style and day-of-week/day-style expressions in date-time cases.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • craftercms/studio-ui#4648: Both PRs modify/consume the same populate-date expression logic used by new DateTime/Time controls and date-time-expression-input validator/input, with this PR's macro support directly enabling the retrieved PR's functionality.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only a link to the GitHub issue without providing substantive context about the changes, objectives, or implementation details that would help reviewers understand the scope of the work. Expand the description to include a summary of changes (validation enhancements, new macro formats supported) and clearly describe the objectives and testing requirements referenced in the PR comments.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enhancing macro support for populating dates and times in the date-time picker, which aligns with the modifications to validation and processing logic for date macros.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/src/components/FormsEngine/lib/controlHelpers.tsx`:
- Around line 486-487: Validation accepts offset-only macros like "+1d" or
"-2weeks" but the processing/parsing code only handles forms starting with
"now"; update the parsing logic that consumes the variable macro (the same
variable named macro in controlHelpers.tsx) to normalize offset-only inputs by
prepending "now" before further parsing (i.e., if macro matches
/^([+-]\d+(d|days|w|weeks|y|years|h|hours|m|minutes))$/i then set macro = "now"
+ macro). Apply this normalization in the parsing code paths referenced around
the existing /^now.../ checks so the validation and computation logic (the macro
parsing block near the later processing code) treat "+/-N(unit)" and
"now+/-N(unit)" equivalently.
- Around line 567-569: The code currently bails out when expression doesn't
match the {macro} regex (macroMatch) and later only validates the macro part (so
malformed full expressions with a bad time suffix slip through); update the
parsing routine in controlHelpers.tsx to first attempt to parse both forms: if
expression matches {macro} with an optional time suffix, validate the time
suffix (HH:MM[:SS]) and the macro token before computing the date, and if
expression does not contain braces treat it as a plain expression and validate
it with the same validator used for macros instead of returning immediately;
ensure the branches referenced by macroMatch and the later validation blocks
(the code around the existing checks at the spots corresponding to lines 595-596
and 628-633) consistently validate the full expression (macro + optional time)
and only compute a Date when both macro and any time suffix are valid, otherwise
return new Date() or a clear error path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 15d2f5ad-83e3-4230-8d4e-860e7bbb08be

📥 Commits

Reviewing files that changed from the base of the PR and between ba3eb57 and a11210f.

📒 Files selected for processing (1)
  • ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

Comment thread ui/app/src/components/FormsEngine/lib/controlHelpers.tsx
Comment thread ui/app/src/components/FormsEngine/lib/controlHelpers.tsx Outdated
@jvega190

Copy link
Copy Markdown
Member Author

@coderabbitai please enumerate the features and routes that QA needs to test based on these changes.

@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read the changed file
cat ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

echo "---GIT DIFF---"
git diff origin/develop...HEAD -- ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

Length of output: 26040


@jvega190 Here is a detailed breakdown of everything QA should cover based on the changes to validateDatePopulateExpression and processPopulateExpression.


🗺️ Routes / Entry Points to Test

All tests are exercised through the FormsEngine date-time picker. QA needs a content type with a Date/Time field whose populate expression (default value macro) is set to each expression below.

Location How to reach it
Content authoring (create) Studio → Sidebar → New Content → select a content type that has a date-time field with a populate expression
Content authoring (edit) Studio → open any existing content item that has such a date-time field
Content type editor Studio → Content Types → Edit a type → Date/Time field properties → populate or default value field (to verify the validator accepts/rejects the expression at config time)

✅ Feature Areas & Test Cases

1. Regression – Existing now / now±N (full unit names)

These must continue to work as before.

Expression Expected result
now Current date/time; with allowPastDate=false seconds are set to :59
now+5days Today + 5 days
now-3weeks Today − 3 weeks
now+1years Today + 1 year
now-4hours Now − 4 hours
now+30minutes Now + 30 minutes

2. 🆕 Short unit abbreviations (d, w, y, h, m)

These are new in this PR and were previously rejected by the validator.

Expression Expected result
now+2d Today + 2 days
now-3w Today − 3 weeks
now+1y Today + 1 year
now-4h Now − 4 hours
now+30m Now + 30 minutes
+5d (no now prefix) Today + 5 days
-2w (no now prefix) Today − 2 weeks

3. 🆕 Day-of-week macros (plain text)

The picker should populate the next occurrence of the given weekday (never the current day, even if today matches).

Expression Expected result
monday / mon Next Monday
tuesday / tue Next Tuesday
wednesday / wed Next Wednesday
thursday / thu Next Thursday
friday / fri Next Friday
saturday / sat Next Saturday
sunday / sun Next Sunday
Edge case: run test on the exact day (e.g., monday on a Monday) Should still return next Monday (+7 days), not today

4. 🆕 {macro} wrapper format

Same semantics as plain macros but wrapped in curly braces.

Expression Expected result
{now} Same as plain now
{now+5d} Today + 5 days
{monday} Next Monday
{fri} Next Friday
{NOW} / {MONDAY} Case-insensitive; same results as lowercase
{ now } (spaces inside braces) Should be trimmed and accepted

5. 🆕 {macro} with static time suffix

The date is computed from the macro, then the time component is overwritten with the static value.

Expression Expected result
{now} 09:00 Today at 09:00:00
{now} 14:30:45 Today at 14:30:45
{monday} 08:00 Next Monday at 08:00:00
{now+5days} 23:59 Today + 5 days at 23:59:00
{fri} 00:00:00 Next Friday at midnight
Edge: midnight {now} 00:00 Today at 00:00 (not rejected as "past")
Edge: single-digit hour {now} 9:05 Should be accepted ([01]?\d)

6. 🆕 Validation – expressions that must be rejected

Verify the date-time picker shows a validation error or falls back to now for these.

Invalid expression Why it should fail
{foobar} Unrecognised macro
{now} 25:00 Invalid hour (> 23)
{now} 9:70 Invalid minutes (> 59)
{now} 9:30:70 Invalid seconds (> 59)
{now} 9 Missing minutes
now+ Incomplete relative expression
nowdays Missing +/- and numeric value
`` (empty string) Falsy guard at top of validator
null / undefined Falsy guard at top of validator

7. allowPastDate flag behaviour

Scenario allowPastDate Expected
Invalid expression fallback false Returns current time with seconds set to :59
Invalid expression fallback true Returns current time with actual seconds
now expression false Seconds set to :59
now expression true Seconds unchanged
Day-of-week macro either Seconds not forced to :59 (only now path applies this)

8. Case-insensitivity (cross-cutting)

Test each category above with UPPER, lower, and Mixed case to confirm the .toLowerCase() normalisation works end-to-end (e.g., MONDAY, NOW+5D, {FRI} 14:00).

@jvega190 jvega190 marked this pull request as ready for review May 22, 2026 17:32
@jvega190 jvega190 requested a review from rart as a code owner May 22, 2026 17:32
@jvega190

Copy link
Copy Markdown
Member Author

Expressions in Type Builder control tooltip need to be updated

@jvega190 jvega190 marked this pull request as draft June 18, 2026 14:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx`:
- Around line 31-33: The three constant strings DATE_TIME_FORMAT_OFFSET,
DATE_TIME_FORMAT_DAY, and DATE_TIME_EXAMPLE in the DateTimeExpressionInput
component are incomplete and missing documentation for newly supported
expression variants. Update DATE_TIME_FORMAT_OFFSET to include short unit
variants (d, w, y, h, m) in addition to the long forms. Update
DATE_TIME_FORMAT_DAY to document that plain day names without braces are also
accepted. Update DATE_TIME_EXAMPLE to include concrete examples showing short
unit usage (like now+5d, now-2w), offset-only forms (like +5d, -2w), and plain
day names (like monday, friday) to give users complete information about all
supported formats.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9411534b-528f-4458-adfc-cc404da264ff

📥 Commits

Reviewing files that changed from the base of the PR and between b44dc9f and cddca3e.

📒 Files selected for processing (1)
  • ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

Comment thread ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx Outdated
@jvega190 jvega190 marked this pull request as ready for review June 18, 2026 17:10
@rart

rart commented Jun 25, 2026

Copy link
Copy Markdown
Member

@coderabbitai, how does this work look to be merged? Any issues you can point out?

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== CHANGED FILES =="
git diff --name-only origin/develop...HEAD

echo
echo "== OUTLINE: ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
ast-grep outline ui/app/src/components/FormsEngine/lib/controlHelpers.tsx --view expanded || true

echo
echo "== DIFF: ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
git diff --unified=80 origin/develop...HEAD -- ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

echo
echo "== OUTLINE: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
ast-grep outline ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx --view expanded || true

echo
echo "== DIFF: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
git diff --unified=80 origin/develop...HEAD -- ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== SEARCH FOR RELATED TESTS =="
rg -n --hidden -S "validateDatePopulateExpression|processPopulateExpression|DateTimeExpressionInput|populate expression|allowPastDate" ui/app -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**' || true

echo
echo "== FIND CANDIDATE TEST FILES =="
fd -i 'controlHelpers' ui/app || true
fd -i 'DateTimeExpressionInput' ui/app || true
fd -i 'test' ui/app/src/components/FormsEngine || true

Length of output: 23138



@rart I’d call this close, but not quite merge-ready yet.

Two issues stand out:

  1. Missing automated coverage

    • I couldn’t find tests for ui/app/src/components/FormsEngine/lib/controlHelpers.tsx around validateDatePopulateExpression / processPopulateExpression.
    • Given how many branches were added here—plain weekdays, abbreviated units, {macro} parsing, optional static time, invalid fallback behavior, and allowPastDate nuances—that’s the main risk before merge.
  2. Tooltip/docs don’t fully match actual behavior

    • In ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx, the tooltip says:
      • now [+ or -] [number] ... [optional HH:mm[:ss]]
      • {day-of-week} [optional HH:mm[:ss]]
    • But the validator in ui/app/src/components/FormsEngine/lib/controlHelpers.tsx actually supports:
      • plain day-of-week macros too: monday, mon, etc.
      • static time only on the {macro} form, not on plain now+2d 09:00
    • So the help text is a bit misleading in both directions.

My read on overall quality:

  • The core parsing logic looks reasonable.
  • I don’t see an obvious merge blocker in the implementation itself.
  • But I would want the tooltip corrected and at least focused tests added before merging.

Suggested minimum before merge:

  • Add tests for:
    • now, now±N with full + abbreviated units
    • plain weekday macros and {weekday}
    • {macro} HH:mm[:ss]
    • invalid expressions / fallback behavior
    • allowPastDate behavior
  • Align tooltip text/examples with what the validator really accepts.

So: probably safe after one more pass, but I wouldn’t merge as-is without those fixes.

@rart rart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See rabbit. Make sure rabbit clears your last commit (always).

…er clarity and consistency; improve date validation logic in processPopulateExpression to prevent past date selection.
@jvega190

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== PR HEAD =="
git rev-parse --short HEAD

echo
echo "== CHANGED FILES =="
git diff --name-only origin/develop...HEAD

echo
echo "== OUTLINE: ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
ast-grep outline ui/app/src/components/FormsEngine/lib/controlHelpers.tsx --view expanded || true

echo
echo "== DIFF: ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
git diff --unified=40 origin/develop...HEAD -- ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

echo
echo "== OUTLINE: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
ast-grep outline ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx --view expanded || true

echo
echo "== DIFF: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
git diff --unified=40 origin/develop...HEAD -- ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== SEARCH FOR RELATED TESTS / USAGES =="
rg -n -C2 --hidden -S "validateDatePopulateExpression|processPopulateExpression|DateTimeExpressionInput|allowPastDate|getNextDayOfWeek|setTimeOnDate" ui/app \
  -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**' || true

echo
echo "== CANDIDATE TEST FILES =="
fd -i 'controlHelpers' ui/app || true
fd -i 'DateTimeExpressionInput' ui/app || true
fd -i 'test' ui/app/src/components/FormsEngine || true
fd -i 'spec' ui/app/src/components/FormsEngine || true

echo
echo "== READ RELEVANT TOOLTIP SECTION =="
sed -n '1,220p' ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== READ RELEVANT HELPER SECTION =="
sed -n '250,470p' ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

Length of output: 44606



@jvega190 I took a final pass over the current head (4dc5ef729).

Bottom line: this looks close, but I wouldn’t hand it off as fully ready yet. The core parser changes look reasonable, but I still see a few important gaps:

  1. Tooltip still over-promises supported syntax

    • In ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx, Line 31 and Line 33 say [optional HH:mm[:ss]] for the displayed date formats.
    • But in ui/app/src/components/FormsEngine/lib/controlHelpers.tsx, the validator only accepts a time suffix on the {macro} form. Plain expressions like now+2d 09:00 or monday 09:00 are still invalid.
    • So the help text is still not fully aligned with actual behavior.
  2. {now} HH:mm[:ss] can be rewritten unexpectedly when allowPastDate=false

    • In ui/app/src/components/FormsEngine/lib/controlHelpers.tsx, Line 635 onward, if a static time produces a past datetime, the code falls back to “now” with seconds set to :59.
    • That means something like {now} 00:00 will not stay at midnight for most of the day.
    • This may be intended, but it’s important enough that I’d want it explicitly confirmed before handoff.
  3. Still no automated coverage

    • I couldn’t find tests covering validateDatePopulateExpression / processPopulateExpression.
    • With the added branches for short units, weekday macros, {macro} parsing, optional static time, and allowPastDate behavior, this is still the biggest quality risk.

So my final recommendation is:

  • Fix the tooltip wording so it only documents syntax the validator actually accepts.
  • Confirm or adjust the allowPastDate=false behavior for {now} HH:mm[:ss}.
  • Add focused unit tests before sending this for human review.

If those are addressed, I’d be much more comfortable calling it ready.

…larity; enhance validation documentation in controlHelpers to specify valid expression formats and behavior regarding past dates.
@jvega190

jvega190 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review. Tests won't be added yet, and the point number 2 of the review is intended

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

#!/bin/bash
set -euo pipefail

echo "== PR HEAD =="
git rev-parse --short HEAD

echo
echo "== CHANGED FILES =="
git diff --name-only origin/develop...HEAD

echo
echo "== DIFF: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
git diff --unified=60 origin/develop...HEAD -- ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== READ: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
sed -n '1,220p' ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== DIFF: ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
git diff --unified=80 origin/develop...HEAD -- ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

echo
echo "== READ: validator/processor section in ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
sed -n '520,760p' ui/app/src/components/FormsEngine/lib/controlHelpers.tsx
#!/bin/bash
set -euo pipefail

echo "== PR HEAD =="
git rev-parse --short HEAD

echo
echo "== CHANGED FILES =="
git diff --name-only origin/develop...HEAD

echo
echo "== DIFF: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
git diff --unified=60 origin/develop...HEAD -- ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== READ: ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx =="
sed -n '1,220p' ui/app/src/components/ContentTypeManagement/controls/DateTimeExpressionInput.tsx

echo
echo "== DIFF: ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
git diff --unified=80 origin/develop...HEAD -- ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

echo
echo "== READ: validator/processor section in ui/app/src/components/FormsEngine/lib/controlHelpers.tsx =="
sed -n '520,760p' ui/app/src/components/FormsEngine/lib/controlHelpers.tsx

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@jvega190 Thanks for the clarification.

With that context, I’d say this is good to hand over for human review.

My final take:

  • I don’t see a blocking implementation issue in the parser/validator changes.
  • Your clarification that the allowPastDate=false behavior for {now} HH:mm[:ss] is intended removes my main functional concern there.
  • The remaining caveat is still lack of automated coverage, but since that’s explicitly deferred, I’d treat it as known risk, not a blocker for human review.

So my recommendation is:

  • Ready for human review
  • Known risk: edge-case regressions are harder to catch until tests are added
  • Manual QA should still cover the main paths we listed earlier: create/edit/type builder, short units, weekday macros, {macro} forms, optional static time, invalid expressions, and allowPastDate

I wouldn’t block this handoff on anything else from my side.


✏️ Learnings added
Learnt from: jvega190
URL: https://github.com/craftercms/studio-ui/pull/4864

Timestamp: 2026-06-25T17:19:53.823Z
Learning: In PR `#4864` for `ui/app/src/components/FormsEngine/lib/controlHelpers.tsx`, the behavior where `processPopulateExpression` with `allowPastDate=false` can replace a past `{now} HH:mm[:ss]` result with the current time is intended behavior and should not be flagged as a bug in future reviews of this change.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants