Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nicolas Frandeboeuf
kresus
Commits
ff506338
Commit
ff506338
authored
May 21, 2017
by
Benjamin Bouvier
Browse files
Fixes #588: In the budget periods selector, display current month/year if there
are no operations;
parent
ff6f9c8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/components/budget/index.js
View file @
ff506338
...
...
@@ -236,11 +236,10 @@ const Export = connect((state, ownProps) => {
let
operations
=
get
.
operationsByAccountIds
(
state
,
currentAccountId
);
let
periods
=
[];
let
currentDate
=
new
Date
();
let
currentYear
=
currentDate
.
getFullYear
();
let
currentMonth
=
currentDate
.
getMonth
();
if
(
operations
.
length
)
{
let
currentDate
=
new
Date
();
let
currentYear
=
currentDate
.
getFullYear
();
let
currentMonth
=
currentDate
.
getMonth
();
let
year
=
operations
[
operations
.
length
-
1
].
date
.
getFullYear
();
while
(
year
<=
currentYear
)
{
let
month
=
0
;
...
...
@@ -254,6 +253,12 @@ const Export = connect((state, ownProps) => {
}
year
++
;
}
}
else
{
// Just put the current month/year pair if there are no operations.
periods
.
push
({
month
:
currentMonth
,
year
:
currentYear
});
}
return
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment