mistercrunch commented on a change in pull request #4647: Add play slider to 
screengrid
URL: 
https://github.com/apache/incubator-superset/pull/4647#discussion_r175615988
 
 

 ##########
 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:
   Wondering if we can have a single authority on time grain parsing between 
the frontend & backend.  Backend has `utils.parse_human_datetime` leveraging 
the `parsedatetime` lib. Just worried there's divergence into what the backend 
and frontend understand.
   
   The backend could return its understanding of granularity to be available to 
the frontend in the payload. This may require a bit more thinking.

----------------------------------------------------------------
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

Reply via email to