-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set default date to the date we have data for all 3 sensors.
- Loading branch information
1 parent
866ecda
commit 63d23f2
Showing
3 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<script> | ||
import { formatAPITime } from '../data'; | ||
import { formatDateYearDayOfWeekAbbr } from '../formats'; | ||
/** | ||
* @type {import("../stores/params").DateParam} | ||
*/ | ||
export let date; | ||
/** | ||
* @type {import("../stores/params").DateParam} | ||
*/ | ||
export let minMaxDate; | ||
/** | ||
* @type {import('../stores/params').SensorParam} | ||
*/ | ||
export let casesSensor; | ||
/** | ||
* @type {import('../stores/params').SensorParam} | ||
*/ | ||
export let deathSensor; | ||
/** | ||
* @type {import('../stores/params').SensorParam} | ||
*/ | ||
export let hospitalAdmissionSensor; | ||
let todaysDate = new Date(); | ||
let casesMaxDate = new Date(); | ||
let deathSensorMaxDate = new Date(); | ||
let hospitalAdmissionMaxDate = new Date(); | ||
casesMaxDate = casesSensor.timeFrame.max; | ||
deathSensorMaxDate = deathSensor.timeFrame.max; | ||
hospitalAdmissionMaxDate = hospitalAdmissionSensor.timeFrame.max; | ||
</script> | ||
|
||
{#if casesMaxDate.toString() != date.value.toString() || deathSensorMaxDate.toString() != date.value.toString() || hospitalAdmissionMaxDate.toString() != date.value.toString()} | ||
<div data-uk-alert class="uk-alert-warning"> | ||
<p> | ||
The data for the {formatDateYearDayOfWeekAbbr(todaysDate)} is not available yet. The latest known data for all indicators | ||
is available on | ||
<a href="?date={formatAPITime(minMaxDate.value)}&{window.location.search.split('&').slice(1).join('&')}" | ||
>{formatDateYearDayOfWeekAbbr(minMaxDate)}</a | ||
>. | ||
</p> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters