mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 02:40:43 -06:00
Fix #7683
This commit is contained in:
parent
55e4479454
commit
3d8bf3ec9b
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Controllers\Json;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\RecurrenceRepetition;
|
||||
@ -150,10 +151,13 @@ class RecurrenceController extends Controller
|
||||
*/
|
||||
public function suggest(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate(['date' => ['required', 'date'],]);
|
||||
$string = $request->get('date') ?? date('Y-m-d');
|
||||
$string = '' === (string)$request->get('date') ? date('Y-m-d') : (string)$request->get('date');
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
$date = Carbon::createFromFormat('Y-m-d', $string)->startOfDay();
|
||||
try {
|
||||
$date = Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'))->startOfDay();
|
||||
} catch(InvalidFormatException $e) {
|
||||
$date = Carbon::today(config('app.timezone'));
|
||||
}
|
||||
$preSelected = (string)$request->get('pre_select');
|
||||
$locale = app('steam')->getLocale();
|
||||
|
||||
|
4
public/v1/js/ff/recurring/create.js
vendored
4
public/v1/js/ff/recurring/create.js
vendored
@ -116,9 +116,9 @@ function respondToFirstDateChange() {
|
||||
preSelected = select.val();
|
||||
}
|
||||
|
||||
$.getJSON(suggestUrl, {date: date,pre_select: preSelected}).fail(function () {
|
||||
$.getJSON(suggestUrl, {date: date,pre_select: preSelected, past: 'true'}).fail(function () {
|
||||
console.error('Could not load repetition suggestions');
|
||||
alert('Could not load repetition suggestions');
|
||||
alert('Could not load repetition suggestions. Please enter a valid date.');
|
||||
}).done(parseRepetitionSuggestions);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<div class="{{ classes }}" id="{{ name }}_holder">
|
||||
{{ dump(options) }}
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
|
||||
|
||||
@ -8,7 +7,6 @@
|
||||
<div class="input-group-addon">
|
||||
<span class="fa fa-calendar"></span>
|
||||
</div>
|
||||
|
||||
{{ Html.input('date', name, value).id(options.id).class('form-control').attribute('autocomplete','off').attribute('spellcheck','false')
|
||||
.attribute('min', options.min)
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user