Skip to content

Commit

Permalink
timetag.start_of_year/month/day
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 10, 2020
1 parent 9c999f0 commit faeb2ce
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,36 @@ public static void registerTags() {
return new TimeTag(outTime.year(), outTime.month(), outTime.day(), 0, 0, 0, 0, object.instant.getOffset());
});

// <--[tag]
// @attribute <TimeTag.start_of_year>
// @returns TimeTag
// @description
// Returns this time tag, with the month/day/hour/minute/second/millisecond zeroed (that is, midnight the morning of the first day of the same month).
// -->
registerTag("start_of_year", (attribute, object) -> {
return new TimeTag(object.year(), 1, 1, 0, 0, 0, 0, object.instant.getOffset());
});

// <--[tag]
// @attribute <TimeTag.start_of_month>
// @returns TimeTag
// @description
// Returns this time tag, with the day/hour/minute/second/millisecond zeroed (that is, midnight the morning of the first day of the same month).
// -->
registerTag("start_of_month", (attribute, object) -> {
return new TimeTag(object.year(), object.month(), 1, 0, 0, 0, 0, object.instant.getOffset());
});

// <--[tag]
// @attribute <TimeTag.start_of_day>
// @returns TimeTag
// @description
// Returns this time tag, with the hour/minute/second/millisecond zeroed (that is, midnight the morning of the same day).
// -->
registerTag("start_of_day", (attribute, object) -> {
return new TimeTag(object.year(), object.month(), object.day(), 0, 0, 0, 0, object.instant.getOffset());
});

// <--[tag]
// @attribute <TimeTag.add[<duration>]>
// @returns TimeTag
Expand Down

0 comments on commit faeb2ce

Please sign in to comment.