Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WIE_202021_CSBillero11
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bernard Roland (Student Com20)
WIE_202021_CSBillero11
Commits
fed6add2
Commit
fed6add2
authored
3 years ago
by
Planoetscher Daniel (Student Com20)
Browse files
Options
Downloads
Patches
Plain Diff
fix for default deadline when editing project
parent
cd12ceaa
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/src/components/forms/ProjectForm/index.tsx
+5
-3
5 additions, 3 deletions
client/src/components/forms/ProjectForm/index.tsx
client/src/timely.test.ts
+4
-0
4 additions, 0 deletions
client/src/timely.test.ts
client/src/timely.ts
+3
-0
3 additions, 0 deletions
client/src/timely.ts
with
12 additions
and
3 deletions
client/src/components/forms/ProjectForm/index.tsx
+
5
−
3
View file @
fed6add2
...
...
@@ -13,6 +13,7 @@ import CheckboxGroup from 'components/ui/CheckboxGroup';
import
'
../form.scss
'
;
import
'
./project-form.scss
'
;
import
{
formatDate
,
formatDateShort
}
from
'
timely
'
;
interface
Props
{
project
?:
Project
...
...
@@ -63,7 +64,7 @@ export default function ProjectForm({ project, onSubmit }: Props) {
const
[
text
,
setText
]
=
useState
(
project
?.
text
);
const
[
status
,
setStatus
]
=
useState
(
project
?.
status
);
const
[
color
,
setColor
]
=
useState
(
project
?.
color
);
const
[
deadline
,
setDeadline
]
=
useState
(
project
?.
deadline
?.
toISOString
()
);
const
[
deadline
,
setDeadline
]
=
useState
(
project
?.
deadline
?
formatDateShort
(
new
Date
(
project
?.
deadline
))
:
''
);
const
[
error
,
setError
]
=
useState
(
''
);
const
[
loadError
,
setLoadError
]
=
useState
(
false
);
const
[
teams
,
setTeams
]
=
useState
(
project
?.
teams
??
[]);
...
...
@@ -85,7 +86,7 @@ export default function ProjectForm({ project, onSubmit }: Props) {
}
setAllTeams
(
teams
);
})
.
catch
(()
=>
setLoadError
(
true
))
.
catch
(()
=>
setLoadError
(
true
))
},
[
project
?.
teams
,
loadError
])
const
colors
=
Object
.
values
(
ProjectColors
);
...
...
@@ -105,6 +106,7 @@ export default function ProjectForm({ project, onSubmit }: Props) {
}
},
[
onSubmit
,
setError
,
name
,
text
,
color
,
deadline
,
teams
,
status
]);
return
(
<
form
onSubmit
=
{
handleSubmit
}
className
=
{
'
project-form theme-
'
+
color
}
>
{
error
&&
<
Callout
message
=
{
error
}
/>
}
...
...
@@ -174,7 +176,7 @@ export default function ProjectForm({ project, onSubmit }: Props) {
<
div
className
=
"teams"
>
<
h2
>
Teams
</
h2
>
<
p
>
Which ones of your teams are working on this project
</
p
>
{
loadError
{
loadError
?
<
ErrorScreen
/>
:
<
CheckboxGroup
choices
=
{
allTeams
}
chosen
=
{
teams
}
setChosen
=
{
setTeams
}
/>
}
...
...
This diff is collapsed.
Click to expand it.
client/src/timely.test.ts
+
4
−
0
View file @
fed6add2
...
...
@@ -8,6 +8,7 @@ import {
addTime
,
subtractTime
,
durationFor
,
formatDateShort
}
from
'
timely
'
;
test
(
'
simple duration format works as expected
'
,
()
=>
{
...
...
@@ -397,3 +398,6 @@ test('get duration from amount and unit', () => {
expect
(
durationFor
(
10
,
'
hour
'
)).
toEqual
(
10
*
60
*
60
*
1000
);
});
test
(
'
format simple date
'
,
()
=>
{
expect
(
formatDateShort
(
new
Date
(
'
2021-04-29T00:00:00
'
))).
toEqual
(
'
2021-04-29
'
);
});
This diff is collapsed.
Click to expand it.
client/src/timely.ts
+
3
−
0
View file @
fed6add2
...
...
@@ -217,3 +217,6 @@ export function currentTime(): Date {
return
new
Date
();
}
export
function
formatDateShort
(
date
:
Date
):
string
{
return
date
.
getFullYear
()
+
'
-
'
+
formatNumber
(
date
.
getMonth
()
+
1
)
+
'
-
'
+
formatNumber
(
date
.
getDate
());
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment