@fmidev/smartmet-alert-client 4.1.8 → 4.2.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.
@@ -94,6 +94,12 @@ export default {
94
94
  return regions
95
95
  }, [])
96
96
  },
97
+ landBorders() {
98
+ return this.areaBorders('land')
99
+ },
100
+ seaBorders() {
101
+ return this.areaBorders('sea')
102
+ },
97
103
  yellowCoverages() {
98
104
  return this.coverageGeom(`coverages${this.size}`, 0, 1, 2)
99
105
  },
@@ -130,6 +136,16 @@ export default {
130
136
  .join('')
131
137
  )
132
138
  },
139
+ areaBorders(area) {
140
+ return [
141
+ {
142
+ key: `border.${area}`,
143
+ d: this.geometries[this.geometryId]['borders'][area][`path${this.size}`],
144
+ opacity: '1',
145
+ strokeWidth: this.strokeWidth,
146
+ },
147
+ ]
148
+ },
133
149
  relativeCoverageFromReference(reference) {
134
150
  if (reference == null) {
135
151
  return 0
@@ -179,33 +195,35 @@ export default {
179
195
  },
180
196
  msSinceStartOfDay(timestamp) {
181
197
  const moment = this.toTimeZone(timestamp)
182
- return ((moment.hour * 60 + moment.minute) * 60 + moment.second) * 1000
198
+ const ms = ((moment.hour * 60 + moment.minute) * 60 + moment.second) * 1000 + moment.millisecond
199
+ // Daylight saving time
200
+ const ref = this.toTimeZone(timestamp - ms)
201
+ if (ref.day !== moment.day) {
202
+ return ms - 60 * 60 * 1000
203
+ }
204
+ return ms + ref.hour * 60 * 60 * 1000
183
205
  },
184
206
  effectiveDays(start, end, dailyWarning) {
185
207
  const offset = this.timeOffset
186
208
  const referenceTime =
187
209
  this.startFrom === 'updated' ? this.updatedAt : this.currentTime
210
+ const day = 1000 * 60 * 60 * 24
188
211
  return [...Array(this.NUMBER_OF_DAYS).keys()].map((index) => {
189
- const date = new Date(referenceTime)
190
- date.setDate(date.getDate() + index)
191
- const day = this.toTimeZone(date)
192
- const startOfDay = new Date(day.year, day.month - 1, day.day)
212
+ const dayTime = referenceTime + index * day
213
+ const dayStartOffset = this.msSinceStartOfDay(dayTime)
214
+ let startOfDay = dayTime - dayStartOffset
215
+
216
+ const nextDayTime = referenceTime + (index + 1) * day
217
+ const nextDayStartOffset = this.msSinceStartOfDay(nextDayTime)
218
+ let startOfNextDay = nextDayTime - nextDayStartOffset
193
219
 
194
- const nextDate = new Date(referenceTime)
195
- nextDate.setDate(nextDate.getDate() + index + 1)
196
- const nextDay = this.toTimeZone(nextDate)
197
- const startOfNextDay = new Date(
198
- nextDay.year,
199
- nextDay.month - 1,
200
- nextDay.day
201
- )
202
220
  if (!dailyWarning) {
203
- startOfDay.setMilliseconds(offset)
204
- startOfNextDay.setMilliseconds(offset)
221
+ startOfDay = startOfDay + offset
222
+ startOfNextDay = startOfNextDay + offset
205
223
  }
206
224
  return (
207
- new Date(start).getTime() < startOfNextDay.getTime() &&
208
- new Date(end).getTime() > startOfDay.getTime()
225
+ new Date(start).getTime() < startOfNextDay &&
226
+ new Date(end).getTime() > startOfDay
209
227
  )
210
228
  })
211
229
  },
@@ -30,5 +30,13 @@ $tooltip-arrow-width: 5px;
30
30
  $tooltip-border-width: 1px;
31
31
  $tooltip-arrow-border-width: $tooltip-arrow-width + $tooltip-border-width;
32
32
  $popup-width: 250px;
33
- $font-family: Roboto, Helvetica, Arial, sans-serif;
33
+
34
+ @font-face {
35
+ font-family: 'Noto Sans';
36
+ font-weight: normal;
37
+ font-style: normal;
38
+ src: url($font-base-path + 'Noto_Sans/Noto-Sans-regular.woff2') format('woff2');
39
+ font-display: swap;
40
+ }
41
+ $font-family: Roboto, Helvetica, Arial, 'Noto Sans', sans-serif;
34
42
  $symbol-font-family: 'Noto Sans', sans-serif;
@@ -185,6 +185,7 @@ span.symbol-text {
185
185
  width: 100%;
186
186
  text-align: center;
187
187
  margin: 0 auto;
188
+ padding: 0;
188
189
  font-family: $symbol-font-family !important;
189
190
  color: #ffffff;
190
191
  text-anchor: middle;