Skip to content

Instantly share code, notes, and snippets.

@zargold
zargold / Filters.js
Created March 21, 2016 17:42
Hours of Labor as Date Time
angular.module('filters', [])
/*
* Creates a time that is the right hour relative to Now
* for displaying a number (or fraction of hours) as a time.
* (4) => 4:00
* (3.17) => 3:10
* (67.291667) => 67:18 (rounds up at .5 of a minute)
* Usage: {{ job.actualHoursSpent | decToHour | date: 'H:mm' }}
* Because it adds on to Angular's built in date filter as above