package jtype

import (
	"strings"
	"time"
)

type Duration time.Duration

func (d *Duration) UnmarshalJSON(b []byte) error {
	dur, err := time.ParseDuration(strings.ReplaceAll(string(b), `"`, ""))
	if err != nil {
		return err
	}
	*d = Duration(dur)
	return nil
}
