question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Last month doesn't adhere to min and max values?

See original GitHub issue

I am using presets and have a preset called ‘Last Month’ that looks like this.

export const LAST_MONTH: DateRangePreset = {
  name: 'Last Month',
  range: [
    moment()
      .subtract(1, 'month')
      .startOf('month'),
    moment()
      .subtract(1, 'month')
      .endOf('month')
  ]
};

I have this construct for internal purposes and just send the range bit to ngx-daterangepicker-material.

This doesn’t seem to be following the minDate and maxDate settings. I have another preset for Last 30 Days which seems to be working fine.

export const LAST_30_DAYS: DateRangePreset = {
  name: 'Last 30 Days',
  range: [moment().subtract(30, 'days'), moment().subtract(1, 'days')]
};

Screenshots

Last Month

image

Last 30 Days

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
praveenpugliacommented, Jul 10, 2018

Further analysis.

So this case arises when the start and end dates are both less than the min date. in that case, last month or any other range doesn’t make any sense. Ideally the option should not even be enabled because those dates don’t exist based on restrictions.

Can we somehow disable a preset option if…

  1. start and end dates are both less than min date
  2. start and end dates are both more than the max date?
0reactions
praveenpugliacommented, Jul 10, 2018

Thanks so much for being such prompt! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Last 7 Month Avg. Minus Min/Max
Your scenario: get the average result from last 7 month, exclude current month, previous month, min and max amount. Logic : summary records...
Read more >
HTML attribute: min - HTML: HyperText Markup Language
The min attribute defines the minimum value that is acceptable and valid for the input containing the attribute. If the value of the...
Read more >
Excel OFFSET function Explained in Simple Steps - XelPlus
OFFSET is a great formula whenever you have dynamic ranges involved. Some examples are: Calculating the average of the last three months when...
Read more >
The I Bond Rate Fell Below 7%. We Answer Your Questions
Yes, you and your partner could each buy $10,000 worth of I bonds. That's the maximum amount you can buy in electronic bonds...
Read more >
DATEADD function - Amazon Redshift - AWS Documentation
The following example adds 30 minutes to a date value that doesn't specify a ... ADD_MONTHS: If the date you are adding to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found