Skip to content

feat(interpreter): add ROUND, MOD, MIN/MAX, TIME, and date part built…#17

Merged
DDecoene merged 1 commit into
DDecoene:mainfrom
kas2804:feature/newfunctions
Jun 27, 2026
Merged

feat(interpreter): add ROUND, MOD, MIN/MAX, TIME, and date part built…#17
DDecoene merged 1 commit into
DDecoene:mainfrom
kas2804:feature/newfunctions

Conversation

@kas2804

@kas2804 kas2804 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #4

Overview
This PR adds the missing standard dBASE III stateless built-in functions to the expression engine, as outlined in the issue.

Changes Included:

  1. Math Functions: Added ROUND(), MOD(), MAX(), and MIN() to Builtins.ts.
  2. Date/Time Functions: Added TIME(), YEAR(), MONTH(), and DAY() to Builtins.ts.
  3. Testing: Added corresponding test cases for all new functions in Builtins.test.ts to ensure correct behavior and edge-case handling (e.g., negative numbers, invalid dates).
  4. Documentation: Updated the README.md command tables

Testing Performed:
All tests passed successfully locally via vitest.

@DDecoene DDecoene merged commit 562c8cb into DDecoene:main Jun 27, 2026
1 check passed
@DDecoene

Copy link
Copy Markdown
Owner

Thank you so much for this, @kas2804! 🙏 This is exactly the kind of contribution that makes the project better — eight new built-ins (ROUND, MOD, MAX, MIN, TIME, YEAR, MONTH, DAY), each with a clean implementation following the existing n()/s() helper conventions and a matching test. ROUND's default-decimals handling and the guarded date parsing were nice touches.

Your work brings the W3Script expression engine noticeably closer to full dBASE III parity. I've credited you in the README's new Contributors section, the CHANGELOG, and CLAUDE.md as part of the v0.8.0 release follow-up (#18). Looking forward to more — thank you for helping keep the dBASE III spirit alive! 🙌

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.

More built-in functions: ROUND(), MOD(), MAX(), MIN(), TIME(), YEAR()/MONTH()/DAY()

2 participants