File tree Expand file tree Collapse file tree 1 file changed +0
-10
lines changed Expand file tree Collapse file tree 1 file changed +0
-10
lines changed Original file line number Diff line number Diff line change 1
1
import { useEffect , useState } from 'react' ;
2
2
3
3
const getClosestTimeZone = ( ) => {
4
- // target 6am
5
-
6
- // go through all timezones
7
- // get current time in that timezone
8
- // get difference between current time and 6am
9
- // return the timezone with the smallest difference
10
-
11
- // get current time
12
4
const currentTime = new Date ( ) ;
13
5
14
- // get the time in each timezone
15
6
const aryIannaTimeZones = Intl . supportedValuesOf ( 'timeZone' ) ;
16
7
17
8
let closestBefore6am = 0 ;
@@ -23,7 +14,6 @@ const getClosestTimeZone = () => {
23
14
} [ ] = [ ] ;
24
15
25
16
aryIannaTimeZones . forEach ( ( timeZone ) => {
26
- // get current hour and minute in this timezone
27
17
const options : Intl . DateTimeFormatOptions = {
28
18
timeZone,
29
19
hour : 'numeric' ,
You can’t perform that action at this time.
0 commit comments