Skip to content

Conversation

@Shubh-Raj
Copy link

@Shubh-Raj Shubh-Raj commented Jan 1, 2026

Summary

Fixes: accordproject/template-playground#14
When Duration or Period types are used in TemplateMark templates, they were rendering as raw JSON instead of human-readable text.

Before

The penalty is {"$class":"
org.accordproject.time@0.3.0.Duration
","amount":2,"unit":"days"}.

After

The penalty is 2 days.

Changes

  • Added src/drafting/Duration/index.ts - formats Duration/Period as "{amount} {unit}"
  • Registered drafters in src/drafting/index.ts (3 lines)
  • Added unit tests in test/DurationDrafter.test.ts

Testing

All 53 tests pass.

Fixes: accordproject/template-playground#14

When Duration or Period types were used in TemplateMark templates,
they rendered as raw JSON. This adds a drafter that formats them as
human-readable text (e.g., '2 days' instead of JSON).

Signed-off-by: Shubh-Raj <shubhraj625@gmail.com>
Signed-off-by: Shubh-Raj <shubhraj625@gmail.com>
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.

TemplateMark not rendering complex data types

1 participant