betodealmeida commented on a change in pull request #4647: Add play slider to
screengrid
URL:
https://github.com/apache/incubator-superset/pull/4647#discussion_r175619827
##########
File path: superset/assets/javascripts/modules/time.js
##########
@@ -0,0 +1,54 @@
+const SECOND = 1000; // milliseconds
+const MINUTE = 60 * SECOND;
+const HOUR = 60 * MINUTE;
+const DAY = 24 * HOUR;
+const WEEK = 7 * DAY;
+const MONTH = 30 * DAY;
+const YEAR = 365 * DAY;
+const QUARTER = YEAR / 4;
+
+const unitsToMilliSeconds = {
+ second: SECOND,
+ minute: MINUTE,
+ hour: HOUR,
+ 'half hour': HOUR / 2, // mssql
+ day: DAY,
+ week: WEEK,
+ month: MONTH,
+ quarter: QUARTER,
+ year: YEAR,
+};
+
+const pattern = new RegExp('^(\\d+)?\\s*(.*)$');
+
+export const parseTimeGrain = function (timeGrain) {
Review comment:
Yeah, that would definitely be better. We can pass an [ISO 8601
duration](https://en.wikipedia.org/wiki/ISO_8601#Time_intervals) as a string.
Let me take a look at it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services