Table of Contents

Class YandexTrackerDuration

Namespace
YandexTracker
Assembly
YandexTracker.dll

Tracker durations (original estimate, remaining estimate, time spent) are ISO 8601 strings such as P1W2DT3H30M, counted in working time: a week is 5 working days and a day is 8 hours. This helper converts them to hours and back by the same rules.

public static class YandexTrackerDuration
Inheritance
YandexTrackerDuration
Inherited Members

Methods

FromHours(decimal, decimal)

Converts working hours to a Tracker duration: whole days as D, the rest as hours and minutes.

public static string FromHours(decimal hours, decimal hoursPerDay = 8)

Parameters

hours decimal

The hours; must not be negative.

hoursPerDay decimal

Working hours in a day; 8 by default.

Returns

string

A duration such as P1DT4H30M; zero is PT0H.

Exceptions

ArgumentOutOfRangeException

hours is negative.

ToHours(string?, decimal, decimal)

Converts a Tracker duration to working hours.

public static decimal? ToHours(string? value, decimal hoursPerDay = 8, decimal daysPerWeek = 5)

Parameters

value string

A duration such as P1DT4H.

hoursPerDay decimal

Working hours in a day; 8 by default.

daysPerWeek decimal

Working days in a week; 5 by default.

Returns

decimal?

The hours, or null for an empty or unrecognized value.