@vixoniccom/footbal-score 1.4.6-dev.2 → 1.4.6-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/main.js +1 -1
- package/build.zip +0 -0
- package/package.json +1 -1
- package/src/components/Table/components/Time.tsx +6 -28
package/build.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import moment from 'moment'
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { FormattedText } from '../../'
|
|
3
4
|
import { resolvedTimezone } from '../../../helpers/getFixture'
|
|
@@ -7,38 +8,15 @@ interface Props {
|
|
|
7
8
|
parameters: VixonicParameters
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const formatFixtureTime = (timestamp: number) => {
|
|
13
|
-
const date = new Date(timestamp * 1000)
|
|
14
|
-
|
|
15
|
-
const dateParts = new Intl.DateTimeFormat('es-ES', {
|
|
16
|
-
timeZone: timezone,
|
|
17
|
-
day: '2-digit',
|
|
18
|
-
month: '2-digit',
|
|
19
|
-
}).formatToParts(date)
|
|
20
|
-
const day = dateParts.find(p => p.type === 'day')?.value ?? ''
|
|
21
|
-
const month = dateParts.find(p => p.type === 'month')?.value ?? ''
|
|
22
|
-
|
|
23
|
-
const timeParts = new Intl.DateTimeFormat('en-US', {
|
|
24
|
-
timeZone: timezone,
|
|
25
|
-
hour: 'numeric',
|
|
26
|
-
minute: '2-digit',
|
|
27
|
-
hour12: true,
|
|
28
|
-
}).formatToParts(date)
|
|
29
|
-
const hour = timeParts.find(p => p.type === 'hour')?.value ?? ''
|
|
30
|
-
const minute = timeParts.find(p => p.type === 'minute')?.value ?? ''
|
|
31
|
-
const period = timeParts.find(p => p.type === 'dayPeriod')?.value?.toLowerCase() ?? ''
|
|
32
|
-
|
|
33
|
-
return { dateStr: `${day}-${month}`, timeStr: `${hour}:${minute} ${period}` }
|
|
34
|
-
}
|
|
11
|
+
const MEXICO_TIMEZONES = ['America/Mexico_City', 'America/Cancun', 'America/Merida', 'America/Monterrey', 'America/Matamoros', 'America/Chihuahua', 'America/Ojinaga', 'America/Mazatlan', 'America/Hermosillo', 'America/Tijuana', 'America/Ensenada']
|
|
12
|
+
const offset = MEXICO_TIMEZONES.includes(resolvedTimezone) ? -3600 : 0
|
|
35
13
|
|
|
36
14
|
export const Time: React.FunctionComponent<Props> = ({ time, parameters }) => {
|
|
37
|
-
const
|
|
15
|
+
const adjusted = time + offset
|
|
38
16
|
return (
|
|
39
17
|
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
40
|
-
<FormattedText text={
|
|
41
|
-
<FormattedText text={
|
|
18
|
+
<FormattedText text={moment.unix(adjusted).format('DD-MM')} format={parameters.timeFormat} />
|
|
19
|
+
<FormattedText text={moment.unix(adjusted).format('h:mm a')} format={parameters.timeFormat} />
|
|
42
20
|
</div>
|
|
43
21
|
)
|
|
44
22
|
}
|