Closed ghost closed 9 years ago
Sorry had to delete my incorrect comment. Was thinking "hey we should refactor this" but turns out, we already had. There is a parse-utils
object that has what you're looking for. You can modify the datePattern
defined at the top.
https://github.com/Quartz/Chartbuilder/blob/master/src/js/util/parse-utils.js
FYI: It gets called by the input parser and there are also a few tests for it.
Great. I'll check it out - and show what I did here. Bloomberg terminals love timestamps and not dates.
I may have misunderstood your question. Are you trying to get it to recognize the text timestamp
or recognize timestamps as dates? I guess it would be both, now that I think about it. Sugar should be able to parse your timestamps just fine, see the docs. You will have to make sure to convert it to a number first, though.
Sorry, yes. I wanted it to recognise a column named "Timestamp". It already recognises data that is of the usual timestamps we use here.
If I understand properly, you'll want to change this line https://github.com/Quartz/Chartbuilder/blob/master/src/js/util/parse-utils.js#L2
var datePattern = /^(date|time|year)$/i;
to
var datePattern = /^(date|time|year|timestamp)$/i;
Works a treat. Thanks.
Chartbuilder 2.0 is awesome. Thanks.
Is there a way to make the sugar parser look for "Timestamp" as well as "Date"?
I looked around and it isn't specified anywhere in your code. I assume is some auto Sugar.js function?