| ... | @@ -186,6 +186,15 @@ pub const DateTime = struct { | ... | @@ -186,6 +186,15 @@ pub const DateTime = struct { |
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| 188 | | 188 | |
| | 189 | pub fn dayOfThisYear(self: Self) u16 { |
| | 190 | var ret: u16 = 0; |
| | 191 | for (range(self.months)) |_, item| { |
| | 192 | ret += self.daysInMonth(@intCast(u16, item)); |
| | 193 | } |
| | 194 | ret += self.days; |
| | 195 | return ret; |
| | 196 | } |
| | 197 | |
| 189 | /// fmt is based on https://momentjs.com/docs/#/displaying/format/ | 198 | /// fmt is based on https://momentjs.com/docs/#/displaying/format/ |
| 190 | pub fn format(self: Self, comptime fmt: string, options: std.fmt.FormatOptions, writer: anytype) !void { | 199 | pub fn format(self: Self, comptime fmt: string, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 191 | _ = options; | 200 | _ = options; |