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

    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
    Member
    • Mar 2014
    • 8455

    #2
    Hi

    Search in files by contents. Search by 'currentMonth' phrase. And you will find places where you can add new predefined ranges.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    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
        Member
        • Mar 2014
        • 8455

        #4
        What result? Some error?
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        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
            Member
            • Mar 2014
            • 8455

            #6
            I don't know. Is your code executed when you run search? Did you check?
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • gribs
              Senior Member
              • May 2015
              • 104

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

              Comment

              Working...