This is a migrated thread and some comments may be shown as answers.

RangeBar UTC issue?

1 Answer 75 Views
Charts
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 06 Apr 2017, 06:44 PM

Hello,
I'm displaying start and end dates in the RangeBar chart.

I'm setting min and max range in the valueAxis as seen here:

valueAxis: {
        min: new Date("2017/04/06 07:00").getTime(),
        max: new Date("2017/04/06 17:00").getTime(),
        majorUnit: 60 * 60 * 1000, // 60 minutes in milliseconds
    labels: {
        template: "#= kendo.toString(new Date(value), 'HH:mm') #"
        }
    },

 

The problem I'm having is getTime() is returning the number of milliseconds since Epoch off by 4 hours.

In the example above, GetTime() returns 1491476400000, or "2017/04/06 11:00" instead of "2017/04/06 07:00"

The label is displaying 07:00.

I'm assuming this is some kind of UTC issue?  I live in the EDT timezone which is UTC-4 hours.
How do I need to do to have getTime() return the proper milliseconds?

Regards,

 

David

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 10 Apr 2017, 05:48 AM
Hello David,

I am not sure if I understand correctly the question, but JavaScript dates work with local time only. If you wish to convert the date to UTC then you can use the toUtcTime method. If this is not what you are trying to achieve the please clarify what values should displayed.

Regards,
Daniel
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Charts
Asked by
David
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or