Skip to content

builtins: add dtfmt and dtparse for date/time#198

Merged
danieljohnmorris merged 1 commit into
mainfrom
fix/datetime-builtins
May 12, 2026
Merged

builtins: add dtfmt and dtparse for date/time#198
danieljohnmorris merged 1 commit into
mainfrom
fix/datetime-builtins

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Time handling was a manual mess of integer epoch arithmetic.

Implementation:

  • dtfmt ts pat formats a unix timestamp as text via strftime-style pattern
  • dtparse s pat reverses it, returns integer timestamp
  • both UTC for now, timezone handling is a follow-up
  • parse failures error with the offending substring in the message
  • opcodes allocated: dtfmt, dtparse

Tests: cross-engine regression tests + examples/datetime.ilo with -- run: directives.

@danieljohnmorris danieljohnmorris force-pushed the fix/datetime-builtins branch 2 times, most recently from 99d5611 to a44fec8 Compare May 12, 2026 09:22
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 64.55224% with 95 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/verify.rs 30.76% 36 Missing ⚠️
src/vm/mod.rs 79.52% 26 Missing ⚠️
src/interpreter/mod.rs 60.46% 17 Missing ⚠️
src/vm/compile_cranelift.rs 15.78% 16 Missing ⚠️

📢 Thoughts on this report? Let us know!

@danieljohnmorris danieljohnmorris force-pushed the fix/datetime-builtins branch 7 times, most recently from fb8741b to 60896c1 Compare May 12, 2026 23:23
Time handling was a manual mess of integer epoch arithmetic. dtfmt
ts pat formats a unix timestamp as text using a strftime-style
pattern. dtparse s pat reverses it, returning an integer timestamp.

Opcodes allocated: dtfmt, dtparse. Both UTC for now; timezone
handling is a follow-up. Parse failures error with the offending
substring in the message.
@danieljohnmorris danieljohnmorris force-pushed the fix/datetime-builtins branch from 60896c1 to f7ebaa7 Compare May 12, 2026 23:31
@danieljohnmorris danieljohnmorris merged commit 0dd1d60 into main May 12, 2026
4 of 5 checks passed
@danieljohnmorris danieljohnmorris deleted the fix/datetime-builtins branch May 12, 2026 23:34
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.

1 participant