mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
Update the ranges to reflect the current dates.
This commit is contained in:
parent
1139f950ed
commit
e9969bdd5f
@ -9,6 +9,7 @@ use Illuminate\Contracts\Auth\Guard;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Session;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* Class SessionFilter
|
||||
@ -68,6 +69,14 @@ class Range
|
||||
}
|
||||
}
|
||||
|
||||
// set current / next / prev month.
|
||||
$current = Carbon::now()->format('F Y');
|
||||
$next = Carbon::now()->endOfMonth()->addDay()->format('F Y');
|
||||
$prev = Carbon::now()->startOfMonth()->subDay()->format('F Y');
|
||||
View::share('currentMonthName', $current);
|
||||
View::share('previousMonthName', $prev);
|
||||
View::share('nextMonthName', $next);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,21 @@ $(function () {
|
||||
|
||||
$('.currencySelect').click(currencySelect);
|
||||
|
||||
ranges = {};
|
||||
ranges[currentMonthName] = [moment().startOf('month'), moment().endOf('month')];
|
||||
ranges[previousMonthName] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
|
||||
ranges[nextMonthName] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')];
|
||||
ranges['Everything'] = [firstDate, moment()];
|
||||
|
||||
$('#daterange').daterangepicker(
|
||||
{
|
||||
ranges: {
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
||||
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')],
|
||||
'Everything': [firstDate, moment()]
|
||||
},
|
||||
//View::share('currentMonthName', $current);
|
||||
//View::share('previousMonthName', $prev);
|
||||
//View::share('nextMonthName', $next);
|
||||
|
||||
|
||||
ranges: ranges
|
||||
,
|
||||
opens: 'left',
|
||||
|
||||
format: 'DD-MM-YYYY',
|
||||
|
@ -132,6 +132,9 @@
|
||||
var dateRangeURL = "{{route('daterange')}}";
|
||||
var token = "{{csrf_token()}}";
|
||||
var firstDate = moment("{{Session::get('first')->format('Y-m-d')}}");
|
||||
var currentMonthName = "{{$currentMonthName}}";
|
||||
var previousMonthName = "{{$previousMonthName}}";
|
||||
var nextMonthName = "{{$nextMonthName}}";
|
||||
$('#daterange span').text(titleString);
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user