• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    preset <ma-date-range-picker>

    Dashboard Designer & Custom AngularJS Pages
    2
    2
    1.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      benaznbe
      last edited by

         <div ng-init="myPresetweek='WEEK_SO_FAR'"></div>
      
                  <ma-date-range-picker style="display: none" update-interval="5 seconds" preset="{{myPresetweek}}" to="toweek" from="fromweek"></ma-date-range-picker>
                  <div id="141455" style="width: 500px; height: 35px; position: absolute; left: 23px; top: 65px;" layout="row">
                      <md-input-container flex=""> 
                      <label>From date</label>
                          <ma-date-picker format="DD-MM-YYYY" mode="date" ng-model="fromweek" disabled></ma-date-picker>
                          </md-input-container>
                          <md-input-container flex="">
                          <label>To date</label>
                          <ma-date-picker format="DD-MM-YYYY" mode="date" ng-model="toweek" disabled></ma-date-picker>
                          </md-input-container>
                  </div>
                  <md-button class="md-raised md-accent md-hue-3" style="top:420px; left:-520px;" ng-click="myPresetweek='PREVIOUS_WEEK'">
                      LAST WEEK
                  </md-button>
                   <md-button class="md-raised md-accent md-hue-3" style="top:420px;" ng-click="myPresetweek='WEEK_SO_FAR'">
                      NEXT WEEK
                  </md-button>
      

      I set the time as WEEK_SO_FAR. I click the LAST WEEK button, it will set up last week. But I click the LAST button. WEEK again, why did not it come back for another week?

      I want this
      WEEK_SO_FAR = 04/03/2018 - 06/03/2018
      click LAST WEEK button = 25/02/2018 - 04/03/2018
      click LAST WEEK button again = 18/02/2018 - 25/02/2018

      thank you for Support

      1 Reply Last reply Reply Quote 0
      • Jared WiltshireJ
        Jared Wiltshire
        last edited by

        The last week preset is literally that, the last week relative to now. It will not keep going back to previous weeks the more times you set it.

        You want something like this -

        <div class="ma-designer-root" id="7a46cbf4-2419-4cb0-b9a6-7b7124ec9b45" style="width: 1366px; height: 768px; position: relative;" to="dateBar.from">
            <ma-date-range-picker id="b8403b65-ce49-44f3-94ec-57038ed74902" style="position: absolute; left: 163px; top: 53px; width: 201.391px; height: 63px;" preset="LAST_1_WEEKS" from="dateBar.from" to="dateBar.to"></ma-date-range-picker>
            <ma-button id="8d0c705f-715f-4704-abc3-eb8c6c8b2ff2" raised="true" style="position: absolute; left: 185px; top: 158px;" label="Go back one week" ng-click="dateBar.from = (dateBar.from | maMoment:'subtract':1:'week'); dateBar.to = (dateBar.to | maMoment:'subtract':1:'week');"></ma-button>
            <div id="699f0a6f-78c0-447e-8ffa-9b30ef7a6d27" style="position: absolute; left: 512px; top: 57px;">From: {{dateBar.from | maMoment:'format':'lll'}}</div>
            <div id="22afa296-ff90-4881-b112-f661222c2b3e" style="position: absolute; left: 512px; top: 79px;">To: {{dateBar.to | maMoment:'format':'lll'}}</div>
        </div>
        

        You may also want to look at using the moment.js startOf() function - https://momentjs.com/docs/#/manipulating/start-of/

        e.g. dateBar.from = (dateBar.from | maMoment:'startOf':'week');

        Developer at Radix IoT

        1 Reply Last reply Reply Quote 0
        • First post
          Last post