Skip to content

Commit df921a9

Browse files
os-zhuangclaude
andcommitted
example(crm): add days_to_close formula using the new daysBetween stdlib fn
Demonstrates (and regression-covers, via the example build) the newly-registered `daysBetween` — the canonical "days remaining" formula. Browser-verified: computes +30/+60/… for open deals and negative for past closed_won dates. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e6c8279 commit df921a9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

examples/app-crm/src/objects/opportunity.object.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ export const Opportunity = ObjectSchema.create({
5050
close_date: Field.date({
5151
label: 'Close Date',
5252
}),
53+
// Exercises the newly-registered `daysBetween` stdlib function — the canonical
54+
// "days remaining" formula (negative once the close date has passed).
55+
days_to_close: Field.formula({
56+
label: 'Days to Close',
57+
expression: cel`record.close_date == null ? 0 : daysBetween(today(), record.close_date)`,
58+
}),
5359
discount_percent: Field.percent({
5460
label: 'Discount %',
5561
defaultValue: 0,

0 commit comments

Comments
 (0)