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
Commits
8977f6f1
Commit
8977f6f1
authored
1 year ago
by
Rémi PAILHAREY
Browse files
Options
Downloads
Patches
Plain Diff
fix: open correct month for newsletter editing
parent
78e0e525
No related branches found
Branches containing commit
No related tags found
2 merge requests
!105
Fix: open correct month for newsletter editing
,
!103
fix: open correct month for newsletter editing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/Newsletter/Newsletter.tsx
+11
-7
11 additions, 7 deletions
src/components/Newsletter/Newsletter.tsx
with
11 additions
and
7 deletions
src/components/Newsletter/Newsletter.tsx
+
11
−
7
View file @
8977f6f1
...
...
@@ -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
())
...
...
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