question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Botbar displaying hours instead of the day when timeframe is day, using timezone

See original GitHub issue

Botbar displays the candle’s time as hours when the timezone is set and time frame is day:

image

I could see there’s a condition on botbar.js at format_date function, enabling timezones only for tf less than a day

    format_date(p) {
        let t = p[1][0]
        t = this.grid_0.ti_map.i2t(t)
        let ti = this.$p.layout.grids[0].ti_map.tf
        // Enable timezones only for tf < 1D
        let k = ti < DAY ? 1 : 0
        let tZ = t + k * this.$p.timezone * HOUR
        //t += new Date(t).getTimezoneOffset() * MINUTE
        let d = new Date(tZ)
        if (p[2] === YEAR || Utils.year_start(t) === t) {
            return d.getUTCFullYear()
        }
        if (p[2] === MONTH || Utils.month_start(t) === t) {
            return MONTHMAP[d.getUTCMonth()]
        }
        // TODO(*) see grid_maker.js
        if (Utils.day_start(tZ) === tZ) return d.getUTCDate()
        let h = Utils.add_zero(d.getUTCHours())
        let m = Utils.add_zero(d.getUTCMinutes())
        return h + ":" + m
    }

But when a timeframe is set (in my case -3) the bot bar shows 03:00, which probably is not considered on this algorithm when Utils.day_start(tZ) is not equal to tZ, once the function to get the first day considering the tZ passed as UTC time, which is not the case.

So, Is this an easy fix to do just enabling timezones for tf also greater than 1D?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
C451commented, Nov 14, 2020

The main problem is that the samplers do not support non-UTC candle closes (including different exchange closing times, unequal month lengths etc), so as I mentioned I need to spend some time thinking about it.

0reactions
adsonviniciuscommented, Jul 8, 2021

Hi Arul, I was using the code-change I mentioned above but as the author said it was a little bit more complicated so I was waiting for an improvement. However the library is not updated as before anymore, so I would recommend you to try what I did.

On Thu, Jul 8, 2021 at 5:33 PM Arul @.***> wrote:

Hello adson , did you find any solution for this, the library is using UTC , but we need our local TZ

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tvjsx/trading-vue-js/issues/158#issuecomment-876727987, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRAKW76TUHZ4RJWSP2EAADTWYDTBANCNFSM4TVJOKIQ .

– Atenciosamente,

Adson Damasceno

Read more comments on GitHub >

github_iconTop Results From Across the Web

Time — Pine Script™ v5 User Manual v5 documentation
The hour variable and the hour() function normally returns a value in the exchange's time zone. Accordingly, plots in blue for both hour...
Read more >
Angular 4 date pipe displays wrong date because of time zones
As you can see, It is displaying the previous day (May 30 instead of May 31). As far as I understand, the problem...
Read more >
Dates and Times | Charts - Google Developers
The below timeline breaks down an average day, using the datetime data type.
Read more >
15: 9.9. Date/Time Functions and Operators - PostgreSQL
For formatting functions, refer to Section 9.8. ... Create timestamp with time zone from year, month, day, hour, minute and seconds fields (negative...
Read more >
Temporal (Date/Time) values - Cypher Manual - Neo4j
There are three ways of specifying a time zone in Cypher: ... if the next component is day of the year, (e.g. +11000-123...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found