1 module viva.time.date; 2 3 import viva.types.number : clamp; 4 5 /++ 6 + An enum containing each month 7 +/ 8 enum Month : ubyte 9 { 10 january = 1, 11 february, 12 march, 13 april, 14 may, 15 june, 16 july, 17 august, 18 september, 19 october, 20 november, 21 december 22 } 23 24 /++ 25 + A struct containing information about a specific date 26 +/ 27 struct Date 28 { 29 /++ 30 + The day number 31 +/ 32 int day; 33 34 /++ 35 + The week number 36 +/ 37 int week; 38 39 /++ 40 + The month number 41 +/ 42 int month; 43 44 /++ 45 + The year 46 +/ 47 long year; 48 49 /++ 50 + Default constructor 51 + Params: 52 + day = The number of day in the week 53 + month = The month number 54 + year = The year 55 +/ 56 this(int day, int month, long year) 57 { 58 this.day = clamp(day, 1, 31); 59 this.week = 0; // TODO: Calculate week 60 this.month = clamp(month, 1, 12); 61 this.year = year; 62 } 63 }