| ... | ... | @@ -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 | 198 | /// fmt is based on https://momentjs.com/docs/#/displaying/format/ |
| 190 | 199 | pub fn format(self: Self, comptime fmt: string, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 191 | 200 | _ = options; |