Document vm_today and datetime support in calculated fields#1167
Document vm_today and datetime support in calculated fields#1167
Conversation
Add collapsible example for date arithmetic in model inventory calculation fields: vm_today, date, datetime, timedelta, relativedelta. Includes next review date and days-remaining countdown examples. Notes timestamp input and string output behavior. [sc-7465]
5f917e9 to
35ddc67
Compare
PR SummaryThis PR introduces a new section in the documentation for the model inventory fields. The changes add detailed, practical examples on how formulas can leverage date arithmetic and the special variable
These enhancements provide users with clear, sample implementations that detail how to work with date and time types within formulas, thereby improving the usability and clarity of the system documentation. Test Suggestions
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Lighthouse check resultsShow Lighthouse scoresFolder depth level checked: 0 Commit SHA: 0322276 Modify the workflow to check a different depth:
|
Validate docs site✓ INFO: A live preview of the docs site is available — Open the preview |
Summary of changes
vm_today,date,datetime,timedelta,relativedelta.vm_today(updates when formula re-runs)..isoformat()for dates).File touched:
site/guide/model-inventory/_field-types.qmd.Findings from codebase investigation
backend/src/backend/utils/code_executor.py): Execution environment injectsvm_today = date.today()and exposesdate,datetime,timedelta,relativedelta(and others) into formula scope. Date fields are passed as values that requireint(params.x) / 1000fordate.fromtimestamp()(JS/Python timestamp precision difference).vm_today).How to test
Open deploy preview → Model inventory → Field types → Calculation, expand "Example — Date arithmetic and vm_today" and confirm table + code blocks render.
[sc-7465]