konecty / Konecty

Konecty Open source Tech Business Platform
https://konecty.com
GNU Affero General Public License v3.0
19 stars 8 forks source link

Date filters accept relative values #148

Open marcusdemoura opened 2 weeks ago

marcusdemoura commented 2 weeks ago

Relative date values are:

last or next

$last-{day of the week/month} $next-{day of the week/month} ie: $last-monday, $next-friday, $last-1, $next-15, $last-12/31

calculated

$minus-{value}{unit} $plus-{value}{unit} ie: $minus-7days, $minus-3hours, $plus-25minutes

aliases

$today, $yesterday, $tomorrow

The SDK needs a method that will calculate these values for the UI

marcusdemoura commented 2 weeks ago

nova proposta seria algo como um objeto

{
  $calculated: {
    week: -4
  }
}

ou mais como o luxon:

{
  $calculated: {
    minus: {
      week: 4
    }
  }
}

assim podemos usar o last e next (o luxon tem um suporte limitado a isso, mas possível)

{
  $calculated: {
    last: 'friday'
  }
}