generalize Duration type, periodFlag.Duration in the template