Add current week and last week in search/filter date ranges

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gribs
    Senior Member
    • May 2015
    • 104

    #1

    Add current week and last week in search/filter date ranges

    Hi,

    Currently, there are many date range filters (current year / month, last month, today, between...).

    But can you help me to add last week and current week filters in date range please?

    In fact, I use currently between filter so, but with the new feature sending automatically grid reports, it is no more relevant

    thank you for your consideration
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9644

    #2
    Hi

    Search in files by contents. Search by 'currentMonth' phrase. And you will find places where you can add new predefined ranges.

    Comment

    • gribs
      Senior Member
      • May 2015
      • 104

      #3
      Hi, thanks but I already tried, with this in Base.php (+ reference added in date.js and datetime js views)

      "case 'currentWeek':
      $dt = new \DateTime();
      $part['AND'] = array(
      $item['field'] . '>=' => $dt->modify('first day of this week')->format('Y-m-d'),
      $item['field'] . '<' => $dt->add(new \DateInterval('P1W'))->format('Y-m-d'),
      );
      break;"

      I also tried "P7D"

      Comment

      • yuri
        EspoCRM product developer
        • Mar 2014
        • 9644

        #4
        What result? Some error?

        Comment

        • gribs
          Senior Member
          • May 2015
          • 104

          #5
          No error, just doesn't work, it shows me results of the first week of the last month I think

          Comment

          • yuri
            EspoCRM product developer
            • Mar 2014
            • 9644

            #6
            I don't know. Is your code executed when you run search? Did you check?

            Comment

            • gribs
              Senior Member
              • May 2015
              • 104

              #7
              Yes it is. It shows me some results but wrong dateinterval

              Comment

              Working...