taskcluster/taskcluster-client.py — pull request #6 by jonasfj (2014-11-26 02:02:49+00:00)
Title: Added fromNow

A small utility `fromNow('1 day 3 hours 23 min')`

Useful for constructing `created` and `deadline`... In the future more things will also carry an optional `expires` property, this utility will be very useful for constructing [RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6) compliant timestamps.

This trivial in Javascript using `new Date().toJSON()`, but pythons default `isoformat()` doesn't add `Z`. Also it's really annoying to construct datetime offsets manually, it gets boring really quickly. Plus this format is useful in templates etc...

I've added the same utility to the node.js client.

**Remark** this is whitespace ignorant, will read day as either "days", "day" or "d", hours as "hours", "hour", "h" and minutes as "minutes", "minute", "min" or "m".
I considered adding year and month, but I realize that month would conflict with minute. We might still add year, but I'm not sure we can add month (we could use capital letters for Month, but it's fragile and easily generates errors).