Skip to content

Commit

Permalink
Add tag duration.in_years
Browse files Browse the repository at this point in the history
Also fix weeks meta
  • Loading branch information
mcmonkey4eva committed Jan 2, 2015
1 parent abe7b69 commit 3b7a233
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/Duration.java
Expand Up @@ -349,11 +349,21 @@ public String getAttribute(Attribute attribute) {
// CONVERSION ATTRIBUTES
/////////////////

// <--[tag]
// @attribute <d@duration.in_years>
// @returns Element(Decimal)
// @description
// returns the number of years in the Duration.
// -->
if (attribute.startsWith("in_years") || attribute.startsWith("years"))
return new Element(seconds / (86400 * 365))
.getAttribute(attribute.fulfill(1));

// <--[tag]
// @attribute <d@duration.in_weeks>
// @returns Element(Decimal)
// @description
// returns the number of days in the Duration.
// returns the number of years in the Duration.
// -->
if (attribute.startsWith("in_weeks") || attribute.startsWith("weeks"))
return new Element(seconds / 604800)
Expand Down

0 comments on commit 3b7a233

Please sign in to comment.