Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WV-3285 Pre-Caching Nearby Non-Subdaily Layers Fix #5380

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/js/map/layerbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default function mapLayerBuilder(config, cache, store) {

// Don't key by time if this is a static layer
if (def.period) {
date = util.toISOStringSeconds(util.roundTimeOneMinute(options.date));
date = util.toISOStringSeconds(util.roundTimeOneMinute(options.date), true);
}
if (isPaletteActive(def.id, activeGroupStr, state)) {
style = getPaletteKeys(def.id, undefined, state);
Expand Down Expand Up @@ -373,7 +373,7 @@ export default function mapLayerBuilder(config, cache, store) {
tileSize: tileSize[0],
};

const urlParameters = `?TIME=${util.toISOStringSeconds(layerDate)}`;
const urlParameters = `?TIME=${util.toISOStringSeconds(layerDate, true)}`;
const sourceURL = def.sourceOverride || configSource.url;
const sourceOptions = {
url: sourceURL + urlParameters,
Expand Down Expand Up @@ -459,7 +459,7 @@ export default function mapLayerBuilder(config, cache, store) {
if (day && def.wrapadjacentdays) {
date = util.dateAdd(date, 'day', day);
}
urlParameters = `?TIME=${util.toISOStringSeconds(util.roundTimeOneMinute(date))}`;
urlParameters = `?TIME=${util.toISOStringSeconds(util.roundTimeOneMinute(date), true)}`;

const sourceOptions = {
url: source.url + urlParameters,
Expand Down
4 changes: 3 additions & 1 deletion web/js/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,12 @@ export default (function(self) {
* @method toISOStringSeconds
* @static
* @param {Date} date the date to convert
* @param {Boolean} shouldRemoveTime if the time should be removed from the date
* @return {string} ISO string in the form of `YYYY-MM-DDThh:mm:ssZ`.
*/
self.toISOStringSeconds = function(date) {
self.toISOStringSeconds = function(date, shouldRemoveTime = false) {
const isString = typeof date === 'string' || date instanceof String;
if (shouldRemoveTime) date = self.clearTimeUTC(date);
const dateString = isString ? date : date.toISOString();
return `${dateString.split('.')[0]}Z`;
};
Expand Down
Loading