Configure data source to always be evaluated at specific date


#1

I have a UI dataSource that needs to have the start/end dates to be set very specifically on certain dates:

If the current date is before July 1st, the start should be June 30th of the current year and end should be July 1st of the current year.

If the current date is >= July first, the start should be June 30 of next year, with the end still being one day later.

Is this possible using createDynamicDate inside of a dataSource? I haven’t seen any examples that seem to do something similar, and I don’t know where to find documentation for that method.


#2

You could add a custom helper function to take care of the logic. As an example, I have a file in ui > content > js > helpers called customUtil.js that looks something like the following:

C3 = window.C3 || {};
C3.customUtil = C3.customUtil || {};

 var customUtils = {

    format: function(format, formatInput, val) {
    ...
    }

 };

_.extend(C3.customUtil, customUtils);

Then I reference this in .c3ui files with {{ C3.customUtils.format(...) }}

I’m not entirely sure if this is the most vetted method though.