esnet / esnet/pond

Rollup with Moment duration or certain duration factory methods generates error

Open
#118 5 comments 0 reactions 1 assignee Claimed by @sartaj10 View on GitHub
bug
Dominant language
TypeScript
Stars
211
Forks
42
PR merge metrics
No merged PRs in 30d

Description

The happy path works:

```
series.fixedWindowRollup({
window(duration('1h')),
aggregation: {v_sum: ['v', sum()]}
})
```

However, the following does not work, and generates `TypeError: Cannot read property 'mid' of undefined`:

```
series.fixedWindowRollup({
window(duration(moment.duration(1, 'h'))),
aggregation: {v_sum: ['v', sum()]}
})
```

Other variants have issues too:

```
duration(moment.duration(1, 'h').asMilliseconds())
```

But, if you hack the `_string` property, it works!

```
const d = duration(moment.duration(1, 'h').asMilliseconds())
d._string = '1h' // Normally is PT1H when moment is used
```

So it seems that rollups are sensitive to the string property?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.