(type)
| 871 | } |
| 872 | |
| 873 | activeProducts (type) { |
| 874 | const now = new Date() |
| 875 | return _.filter((this.get('products') || []), p => { |
| 876 | if (p.product !== type) return false |
| 877 | const hasValidEndDate = (p.endDate && new Date(p.endDate) > now) || !p.endDate |
| 878 | const hasValidStartDate = !p.startDate || new Date(p.startDate) <= now |
| 879 | return hasValidEndDate && hasValidStartDate |
| 880 | }) |
| 881 | } |
| 882 | |
| 883 | expiredProducts (type) { |
| 884 | const now = new Date() |
no test coverage detected