Skip to content

Validate ISO Duration string #1612

Closed
Closed
@austin-payne

Description

@austin-payne

Describe the problem you are trying to fix (provide as much context as possible)

If a payload should contain a duration, it may be desirable to require a ISO duration string rather than a number which assumes the caller knows whether it should be in minutes, hours, etc.

ISO 8601 standard for Durations as defined here could be validatable with joi. moment.js has support for duration strings, so going from a validated duration string to a moment.Duration object to use in whatever way would be seamless.

Which API (or modification of the current API) do you suggest to solve that problem ?

Maybe add a .duration() to DateSchema, or add a DurationSchema, not sure

Are you ready to work on a pull request if your suggestion is accepted ?

Possibly

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions