Skip to content

Commit e9fdcc3

Browse files
authored
fix(4463): millisecond discrepancy was causing wrong Duration Literal calculation (#4465)
1 parent 3df5649 commit e9fdcc3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/shared/contexts/query.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ export const remove = (node: File, test, acc = []) => {
113113
}
114114

115115
const _addWindowPeriod = (ast, optionAST): void => {
116+
const NOW = Date.now()
117+
116118
const queryRanges = find(
117119
ast,
118120
node =>
@@ -121,18 +123,18 @@ const _addWindowPeriod = (ast, optionAST): void => {
121123
(node.arguments[0]?.properties || []).reduce(
122124
(acc, curr) => {
123125
if (curr.key.name === 'start') {
124-
acc.start = propertyTime(ast, curr.value, Date.now())
126+
acc.start = propertyTime(ast, curr.value, NOW)
125127
}
126128

127129
if (curr.key.name === 'stop') {
128-
acc.stop = propertyTime(ast, curr.value, Date.now())
130+
acc.stop = propertyTime(ast, curr.value, NOW)
129131
}
130132

131133
return acc
132134
},
133135
{
134136
start: '',
135-
stop: Date.now(),
137+
stop: NOW,
136138
}
137139
)
138140
)

0 commit comments

Comments
 (0)