1
1
import React from 'react'
2
2
import Image from 'next/image'
3
3
import type { NextPage } from 'next'
4
+ import { useState , useEffect } from 'react'
5
+ import dayjs from 'dayjs'
6
+ import ja from 'dayjs/locale/ja'
7
+ import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'
4
8
5
9
import HumbergerNavigation from '@/components/humberger-menu/HumbergerNavigation'
6
10
@@ -26,9 +30,25 @@ import { useLocale } from '@/hooks/useLocale'
26
30
import useTranslation from 'next-translate/useTranslation'
27
31
28
32
const Home : NextPage = ( ) => {
33
+ dayjs . locale ( ja )
34
+ dayjs . extend ( isSameOrAfter )
35
+
29
36
const { t } = useLocale ( )
30
37
const { lang } = useTranslation ( )
31
38
39
+ const [ isDuringVoteTerm , setIsDuringVoteTerm ] = useState ( false )
40
+
41
+ useEffect ( ( ) => {
42
+ const dayjsCurrentDateTime = dayjs (
43
+ new Date ( ) . toLocaleString ( 'ja-JP' , { timeZone : 'Asia/Tokyo' } )
44
+ )
45
+ const dayjsVoteStartDateTime = dayjs ( '2022-06-24 21:00:00' )
46
+
47
+ setIsDuringVoteTerm (
48
+ dayjsCurrentDateTime . isSameOrAfter ( dayjsVoteStartDateTime )
49
+ )
50
+ } , [ ] )
51
+
32
52
return (
33
53
< div className = "bg-white text-black" >
34
54
< title > { `${ t . PAGE_TITLE_HOME } - ${ t . WEBSITE_TITLE } ` } </ title >
@@ -98,7 +118,7 @@ const Home: NextPage = () => {
98
118
</ div >
99
119
100
120
{ /* 投票開始とともに開く */ }
101
- { false && (
121
+ { isDuringVoteTerm && (
102
122
< div id = "about-check-vote-card" className = "-mt-32 pt-32" >
103
123
< AboutCheckVoteCard />
104
124
</ div >
0 commit comments