Week and Month data types
namespace: MvcControlsToolkit.Core.Types
The MvcControlsToolkit.Core.Business package supplies also specific types for representing months and weeks, Namely the Month, and Week structures.
User may operate on them as on all numeric and DateTime types. Using all <, >, <=, >=, == != operators.
Their ToString()
method produces the same ISO format used by the respective Html5 inputs.
They have also a static Parse
method that ceates these structures from their string ISO representations.
They may be assigned directly to DateTime variables with no cast operation. They are implicitely converted into the first day of the week and in the first say of the month. Viceversa, the static method FromDate get a Week/Month from a date. Available also AddYears, AddMonths and AddWeeks methods that return a new structure with the modified value.
Both may be used as all other simple types in input tag helpers, and are correctly dealt with by Asp.net Mvc model binder.
Week
has the two properties:
- YearNumber
- That gets/sets the year part
- WeekNumber
- That gets/sets the week within the year
Month
has the two properties:
- YearNumber
- That gets/sets the year part
- MonthNumber
- That gets/sets the month within the year