Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
backoffice_client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
backoffice_client
Merge requests
!105
Fix: open correct month for newsletter editing
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fix: open correct month for newsletter editing
dev
into
master
Overview
0
Commits
2
Pipelines
2
Changes
1
Merged
Rémi PAILHAREY
requested to merge
dev
into
master
1 year ago
Overview
0
Commits
2
Pipelines
2
Changes
1
Expand
Related to
#18 (closed)
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
fef48001
2 commits,
1 year ago
1 file
+
11
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/components/Newsletter/Newsletter.tsx
+
11
−
7
Options
@@ -30,14 +30,18 @@ export type ContentItems =
|
''
const
Newsletter
:
React
.
FC
=
()
=>
{
// Functional rule :
// Display next month after the 3rd of the current month
/**
* Display previous month until the newsletter is sent on the 3rd day of the month
*/
const
getCurrentNewsletterDate
=
():
Date
=>
{
const
newsletterDate
=
new
Date
()
if
(
newsletterDate
.
getDate
()
>=
3
)
{
newsletterDate
.
setMonth
(
newsletterDate
.
getMonth
()
+
1
)
}
return
newsletterDate
const
today
=
new
Date
()
const
currentDay
=
today
.
getDate
()
const
currentMonth
=
today
.
getMonth
()
const
currentYear
=
today
.
getFullYear
()
return
currentDay
<
3
?
new
Date
(
currentYear
,
currentMonth
,
1
)
:
new
Date
(
currentYear
,
currentMonth
+
1
,
1
)
}
const
[
date
,
setDate
]
=
useState
<
Date
>
(
getCurrentNewsletterDate
())
Loading