- How do I install builtnoble/duration-fieldtype in a Statamic project?
- Install it with Composer using composer require builtnoble/duration-fieldtype, then follow the repository README for any Statamic addon registration or publishing steps. After installation, add the fieldtype to a blueprint and it will appear in the control panel. Exact Statamic-version-specific steps should always be confirmed in the README.
- Does this package work with Laravel, and which Statamic versions are supported?
- Statamic runs on Laravel, so the fieldtype is used inside a Laravel-backed Statamic project rather than as a standalone Laravel package. The repository README and composer.json are the authoritative place to confirm supported Statamic and PHP versions. Check those before upgrading Statamic.
- How does the duration fieldtype store values in content?
- It stores duration values as integers representing milliseconds, which gives millisecond precision and avoids ambiguous formatted strings. The masked hh:mm input is a control-panel entry convenience; the persisted value is the integer. That makes it consistent for sorting, calculations, and template output.
- How do I render a duration field in an Antlers template?
- Because the stored value is an integer number of milliseconds, you can output it raw in Antlers or format it with your own PHP or Carbon logic. Check the README for any documented Antlers tag or modifier provided by the addon. If none is documented, a small custom modifier is the safest formatting approach.
- What input format does the control panel use for durations?
- Editors enter durations through a masked hh:mm input in the Statamic control panel. The mask keeps entry consistent, while the field stores the equivalent millisecond integer. This is useful for time spans such as video lengths or task estimates.
- Can it handle durations longer than 24 hours or just hh:mm?
- The overview specifies a masked hh:mm input, so it is designed around hours-and-minutes entry rather than a day/hour/minute format. Whether values above 24 hours are accepted depends on the fieldtype's mask implementation. Test a value like 25:00 in your control panel and confirm the stored milliseconds before relying on it for long durations.
- How do I validate duration values in a Statamic blueprint?
- Use Statamic blueprint validation rules on the field and keep the stored value an integer number of milliseconds. Typical rules include required and integer, plus any minimum or maximum constraints your content needs. Confirm the fieldtype's control-panel validation behavior in the README.
- Is the duration fieldtype compatible with Statamic multisite or localization?
- The README excerpt does not document multisite-specific behavior. As a Statamic fieldtype, it follows Statamic's normal field data storage and localization rules for the site or locale you are editing. If durations differ per locale, test saving and retrieving values in each site.
- How should I test duration fields in my application?
- In automated tests, create content with the duration field, save it, and assert that the stored value equals the expected millisecond integer. Use Statamic's testing helpers for your Statamic version and test both control-panel input parsing and template output. Keep formatting logic separately tested if you add a custom modifier.
- Is this package actively maintained, and what alternatives exist?
- Check the builtnoble/duration-fieldtype GitHub repository for recent commits, open issues, and release tags to judge maintenance status. Alternatives include a plain integer field with custom validation or a text field plus a formatter, but those require more manual handling. For millisecond-precise hh:mm entry, this fieldtype is the focused option.