@pingux/astro 1.8.0-alpha.4 → 1.8.0-alpha.7
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.
@@ -97,6 +97,18 @@ var getLocaleTime = function getLocaleTime(_ref2) {
|
|
97
97
|
timeZone: timeZone
|
98
98
|
}, localeOptions));
|
99
99
|
};
|
100
|
+
|
101
|
+
var getTimezoneOffset = function getTimezoneOffset(timeZone) {
|
102
|
+
var now = new Date();
|
103
|
+
var tzString = now.toLocaleString('en-US', {
|
104
|
+
timeZone: timeZone
|
105
|
+
});
|
106
|
+
var localString = now.toLocaleString('en-US');
|
107
|
+
var diff = (Date.parse(localString) - Date.parse(tzString)) / 3600000;
|
108
|
+
var offset = -(diff + now.getTimezoneOffset() / 60);
|
109
|
+
var formattedString = "".concat(offset, ":00");
|
110
|
+
return offset > 0 ? "+".concat(formattedString) : formattedString;
|
111
|
+
};
|
100
112
|
/**
|
101
113
|
* Component allows users to choose a timezone from the list.
|
102
114
|
* You can checkout the default timezones list [here](https://github.com/yury-dymov/react-bootstrap-timezone-picker/blob/master/src/timezones.json).
|
@@ -143,7 +155,7 @@ var TimeZonePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
143
155
|
return (0, _map["default"])(_context5 = (0, _entries["default"])(extendedTimeZonesList)).call(_context5, function (item) {
|
144
156
|
var _item$;
|
145
157
|
|
146
|
-
var gmt = item[
|
158
|
+
var gmt = "GMT".concat(getTimezoneOffset(item[1]));
|
147
159
|
var gmtLabel = item[0].substring(12);
|
148
160
|
var timeZone = (_item$ = item[1]) === null || _item$ === void 0 ? void 0 : _item$.replace(/_/g, ' ');
|
149
161
|
var time = getLocaleTime({
|
@@ -69,7 +69,6 @@ var defaultHover = {
|
|
69
69
|
boxShadow: 'standard'
|
70
70
|
};
|
71
71
|
var defaultFocus = {
|
72
|
-
boxShadow: 'focus',
|
73
72
|
outline: '1px solid',
|
74
73
|
outlineColor: 'active',
|
75
74
|
outlineOffset: '4px'
|
@@ -482,8 +481,7 @@ var colorField = {
|
|
482
481
|
outline: 'none'
|
483
482
|
},
|
484
483
|
'&.is-focused': {
|
485
|
-
borderColor: 'accent.80'
|
486
|
-
boxShadow: 'focus'
|
484
|
+
borderColor: 'accent.80'
|
487
485
|
}
|
488
486
|
};
|
489
487
|
|
@@ -54,6 +54,18 @@ var getLocaleTime = function getLocaleTime(_ref2) {
|
|
54
54
|
timeZone: timeZone
|
55
55
|
}, localeOptions));
|
56
56
|
};
|
57
|
+
|
58
|
+
var getTimezoneOffset = function getTimezoneOffset(timeZone) {
|
59
|
+
var now = new Date();
|
60
|
+
var tzString = now.toLocaleString('en-US', {
|
61
|
+
timeZone: timeZone
|
62
|
+
});
|
63
|
+
var localString = now.toLocaleString('en-US');
|
64
|
+
var diff = (Date.parse(localString) - Date.parse(tzString)) / 3600000;
|
65
|
+
var offset = -(diff + now.getTimezoneOffset() / 60);
|
66
|
+
var formattedString = "".concat(offset, ":00");
|
67
|
+
return offset > 0 ? "+".concat(formattedString) : formattedString;
|
68
|
+
};
|
57
69
|
/**
|
58
70
|
* Component allows users to choose a timezone from the list.
|
59
71
|
* You can checkout the default timezones list [here](https://github.com/yury-dymov/react-bootstrap-timezone-picker/blob/master/src/timezones.json).
|
@@ -100,7 +112,7 @@ var TimeZonePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
100
112
|
return _mapInstanceProperty(_context5 = _Object$entries(extendedTimeZonesList)).call(_context5, function (item) {
|
101
113
|
var _item$;
|
102
114
|
|
103
|
-
var gmt = item[
|
115
|
+
var gmt = "GMT".concat(getTimezoneOffset(item[1]));
|
104
116
|
var gmtLabel = item[0].substring(12);
|
105
117
|
var timeZone = (_item$ = item[1]) === null || _item$ === void 0 ? void 0 : _item$.replace(/_/g, ' ');
|
106
118
|
var time = getLocaleTime({
|
@@ -49,7 +49,6 @@ var defaultHover = {
|
|
49
49
|
boxShadow: 'standard'
|
50
50
|
};
|
51
51
|
var defaultFocus = {
|
52
|
-
boxShadow: 'focus',
|
53
52
|
outline: '1px solid',
|
54
53
|
outlineColor: 'active',
|
55
54
|
outlineOffset: '4px'
|
@@ -462,8 +461,7 @@ var colorField = {
|
|
462
461
|
outline: 'none'
|
463
462
|
},
|
464
463
|
'&.is-focused': {
|
465
|
-
borderColor: 'accent.80'
|
466
|
-
boxShadow: 'focus'
|
464
|
+
borderColor: 'accent.80'
|
467
465
|
}
|
468
466
|
};
|
469
467
|
|