How to update code written for Cesium 1.9 that work in cesium 1.46?

Hi.

I have a code written in cesium 1.9 and i want it to work in cesium 1.46.

What changes in code syntax I have to made.

When I am using cesium.js 1.9 with below code its working fine.

But with cesium.js 1.46 is show error…

Uncaught SyntaxError: Invalid regular expression: /[א-ת؀-ۿݐ-ݿࢠ-ࣿ]/: Range out of order in character class

at new RegExp ()

at Cesium.js:489

at c (Cesium.js:451)

at a (Cesium.js:451)

at c (Cesium.js:451)

at a (Cesium.js:451)

at c (Cesium.js:451)

at a (Cesium.js:451)

at c (Cesium.js:451)

at a (Cesium.js:451)

Code… in cesium 1.9

var gibs = gibs || {};

gibs.Viewer = function(config) {

// Earliest date of Corrected Reflectance in archive: May 8, 2012

var startTime = Cesium.JulianDate.fromDate(

new Date(Date.UTC(2018, 4, 8)));

var endTime = Cesium.JulianDate.now();

// If slightly after midnight, show the previous day’s data while

// the near-real time imagery is processing.

var show = new Date();

if ( show.getUTCHours() < 12 ) {

show.setUTCDate(show.getUTCDate() - 1);

}

var initialTime = Cesium.JulianDate.fromDate(show);

// Keep track of the previous day. Only update the layer on a tick if the

// day has actually changed.

var previousTime = null;

var selectedSet = null;

var clock = new Cesium.Clock({

currentTime: initialTime,

multiplier: 0, // Don’t start animation by default

startTime: startTime,

endTime: endTime,

clockRange: Cesium.ClockRange.CLAMPED

});

// GIBS needs the day as a string parameter in the form of YYYY-MM-DD.

// Date.toISOString returns YYYY-MM-DDTHH:MM:SSZ. Split at the “T” and

// take the date which is the first part.

var isoDate = function(isoDateTime) {

return isoDateTime.split(“T”)[0];

};

// Create the layer for the current day

var createProvider = function(layer_id) {

var layer = config.layers[layer_id];

var time = “”;

if ( layer.startDate ) {

var isoDateTime = clock.currentTime.toString();

time = “?TIME=” + isoDate(isoDateTime);

}

var provider;

if ( !layer.wms ) {

var resolution = config.resolutions[layer.resolution];

var options = {

url: “//map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi” + time,

layer: layer.id,

style: “”,

format: layer.format,

tileMatrixSetID: resolution.tileMatrixSetID,

minimumLevel: 0,

maximumLevel: resolution.maximumLevel,

tileWidth: 512,

tileHeight: 512,

tilingScheme: gibs.GeographicTilingScheme()

};

if ( layer.credit ) {

options.credit = layer.credit;

}

provider = new Cesium.WebMapTileServiceImageryProvider(options);

} else {

var options = {

url: “//map2.vis.earthdata.nasa.gov/wms/wms.php” + time,

layers: layer.id,

parameters: {

transparent: true,

format: “image/png”

}

};

if ( layer.credit ) {

options.credit = layer.credit;

}

provider = new Cesium.WebMapServiceImageryProvider(options);

}

return provider;

};

// Invoked when the current day changes, but do not call this too often

// if the user is sweeping through days.

var updateLayers = _.throttle(function() {

var isoDateTime = clock.currentTime.toString();

var time = isoDate(isoDateTime);

var layers = viewer.scene.imageryLayers;

layers.removeAll();

_.each(selectedSet.layers, function(layer_id) {

layers.addImageryProvider(createProvider(layer_id));

});

var legend = selectedSet.legend;

if ( !legend ) {

$("#legend").hide();

} else if ( legend.type === “scale” ) {

$(".legend-title").html(legend.title);

$(".legend-colorbar").attr(“src”, legend.colorbar);

$(".legend-max").html(legend.max);

$(".legend-min").html(legend.min);

$("#legend .single").hide();

$("#legend .scale").show();

$("#legend").show();

} else {

$(".legend-title").html(legend.title);

$(".legend-color").css(“background-color”, legend.color);

$("#legend .scale").hide();

$("#legend .single").show();

$("#legend").show();

}

}, 250, {leading: true, trailing: true});;

// When the clock changes, check to see if the day has changed and

// replace the current layers/

var onClockUpdate = function() {

var isoDateTime = clock.currentTime.toString();

var time = isoDate(isoDateTime);

if ( time !== previousTime ) {

previousTime = time;

updateLayers();

}

};

var models = ;

_.each(config.sets, function(set) {

var model = new Cesium.ProviderViewModel({

name: set.name,

tooltip: “Hello”,

iconUrl: set.icon,

creationFunction: function() {

// Return an empty set and update the layers in the same

// way done when the clock changes.

selectedSet = set;

_.defer(updateLayers);

return ;

}

});

models.push(model);

});

var viewer = new Cesium.Viewer(“map”, {

clock: clock,

imageryProviderViewModels: models,

terrainProviderViewModels:

});

viewer.timeline.zoomTo(startTime, endTime);

viewer.clock.onTick.addEventListener(onClockUpdate);

onClockUpdate();

viewer.scene.globe.baseColor = Cesium.Color.BLACK;

var getLeadingPoint = function() {

// Set default extent according to time of day:

// at 00:00 UTC, start at far eastern edge of map: “20.6015625,-46.546875,179.9296875,53.015625”

// at 23:00 UTC, start at far western edge of map: “-179.9296875,-46.546875,-20.6015625,53.015625”

var curHour = new Date().getUTCHours();

// For earlier hours when data is still being filled in, force a far eastern perspective

if (curHour < 3) {

curHour = 23;

}

// Adjust for globe view

curHour -= 5;

// Compute east/west bounds

var minLon = 20.6015625 + curHour * (-200.53125/23.0);

var maxLon = minLon + 159.328125;

var minLat = -46.546875;

var maxLat = 53.015625;

return new Cesium.Rectangle(

Cesium.Math.toRadians(minLon),

Cesium.Math.toRadians(minLat),

Cesium.Math.toRadians(maxLon),

Cesium.Math.toRadians(maxLat)

);

};

viewer.camera.viewRectangle(getLeadingPoint());

return viewer;

};

Source of Code: view-source:http://nasa-gibs.github.io/gibs-web-examples/examples/cesium/gibs-layers/

But with cesium.js 1.46 is show error…

Uncaught SyntaxError: Invalid regular expression: /[א-ת؀-ۿݐ-ݿࢠ-ࣿ]/: Range out of order in character class

at new RegExp ()

at Cesium.js:489

at c (Cesium.js:451)

at a (Cesium.js:451)

at c (Cesium.js:451)

at a (Cesium.js:451)

at c (Cesium.js:451)

at a (Cesium.js:451)

at c (Cesium.js:451)

at a (Cesium.js:451)

Cesium.js needs to be interpreted as UTF-8. Typically this is done by setting the Content-Type response header to include the charset:

Content-Type:

application/javascript; charset=utf-8

The URL you linked on github.io already does this, which is why it works there.

Alternatively you can specify in the HTML page, which is we do in all examples in Cesium.