@preference-sl/pref-viewer 2.11.0-beta.2 → 2.11.0-beta.20

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.
@@ -174,7 +174,12 @@ export class FileStorage {
174
174
  xhr.onload = () => {
175
175
  if (xhr.status === 200) {
176
176
  const blob = xhr.response;
177
- const timeStamp = new Date(xhr.getResponseHeader("Last-Modified")).toISOString();
177
+ const lastModified = xhr.getResponseHeader("Last-Modified");
178
+ let timeStamp = null;
179
+ if (lastModified) {
180
+ const parsed = new Date(lastModified);
181
+ timeStamp = Number.isNaN(parsed.valueOf()) ? null : parsed.toISOString();
182
+ }
178
183
  file = { blob: blob, timeStamp: timeStamp };
179
184
  resolve(file);
180
185
  } else {
@@ -204,7 +209,11 @@ export class FileStorage {
204
209
  xhr.responseType = "blob";
205
210
  xhr.onload = () => {
206
211
  if (xhr.status === 200) {
207
- timeStamp = new Date(xhr.getResponseHeader("Last-Modified")).toISOString();
212
+ const lastModified = xhr.getResponseHeader("Last-Modified");
213
+ if (lastModified) {
214
+ const parsed = new Date(lastModified);
215
+ timeStamp = Number.isNaN(parsed.valueOf()) ? null : parsed.toISOString();
216
+ }
208
217
  resolve(timeStamp);
209
218
  } else {
210
219
  resolve(timeStamp);