@@ -39,7 +39,19 @@ const chartElPrev = ref()
3939
4040const getSeries = async () => {
4141 let data = []
42-
42+ let from = parseInt (
43+ DateTime .now ().minus ({
44+ days: props .period .timeframe === " day" ? props .period .value * 2 + 1 : 0 ,
45+ hours: props .period .timeframe === " hour" ? props .period .value * 2 + 1 : 0 ,
46+ }).ts / 1_000
47+ )
48+ let to = parseInt (
49+ DateTime .now ().minus ({
50+ days: props .period .timeframe === " day" ? 1 : 0 ,
51+ hours: props .period .timeframe === " hour" ? 1 : 0 ,
52+ }).ts / 1_000
53+ )
54+
4355 if (props .series .aggregate === ' cumulative' ) {
4456 data = await fetchSeriesCumulative ({
4557 name: props .series .name ,
@@ -49,33 +61,18 @@ const getSeries = async () => {
4961 days: 48 ,
5062 }).ts / 1_000 )
5163 })
52- // data = (await fetchSeriesCumulative({
53- // name: props.series.name,
54- // period: props.period.timeframe,
55- // from: parseInt(
56- // DateTime.now().minus({
57- // days: props.period.timeframe === "day" ? props.period.value * 2 : 0,
58- // hours: props.period.timeframe === "hour" ? props.period.value * 2 : 0,
59- // }).ts / 1_000)
60- // })).reverse()
6164 } else if (props .series .name === " tvs" ) {
6265 data = (await fetchTVS ({
6366 period: props .period .timeframe ,
64- from: parseInt (
65- DateTime .now ().minus ({
66- days: props .period .timeframe === " day" ? props .period .value * 2 : 0 ,
67- hours: props .period .timeframe === " hour" ? props .period .value * 2 : 0 ,
68- }).ts / 1_000 )
67+ from: from,
68+ to: to,
6969 })).map (v => { return { time: v .time , value: v .close } }).reverse ()
7070 } else {
7171 data = (await fetchSeries ({
7272 table: props .series .name ,
7373 period: props .period .timeframe ,
74- from: parseInt (
75- DateTime .now ().minus ({
76- days: props .period .timeframe === " day" ? props .period .value * 2 : 0 ,
77- hours: props .period .timeframe === " hour" ? props .period .value * 2 : 0 ,
78- }).ts / 1_000 )
74+ from: from,
75+ to: to,
7976 })).reverse ()
8077 }
8178
@@ -274,7 +271,11 @@ watch(
274271 </Text >
275272
276273 <Text size =" 11" weight =" 600" color =" tertiary" >
277- Today
274+ {{ DateTime.now().minus({
275+ days: period.timeframe === "day" ? 1 : 0,
276+ hours: period.timeframe === "hour" ? 1 : 0,
277+ }).toFormat("LLL dd")
278+ }}
278279 </Text >
279280 </Flex >
280281 </Flex >
0 commit comments