There is the possibility to mask individual pixels of image of an image collection.
As you do not define any code, I created to sample image datestamps in milliseconds. The start dates are in 2017, the end dates in 2018, to make sure there is always a time window.
// image with DOYs in milliseconds
var date = ee.Date('2017-01-01').millis(); // get a date
var dayToMillis = 24*60*60*1000; //86400000
var randomStarts = ee.Image.random().multiply(365).multiply(dayToMillis)
.add(date).toLong().rename('startDate');
var randomEnds = ee.Image.random().multiply(365).multiply(dayToMillis)
.add(365*dayToMillis).add(date).toLong().rename('endDate');
Then we load a sample image collection, e.g. Landsat-8 and filter for the first image in 2018 to later present just one sample image on the map.
// load an image collection
var imageCollection = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA");
Map.centerObject(imageCollection.filterDate('2018','2019').first());
We can then map over that image collection, make a date image of each image timestamp and mask out every pixel with a date that is lt the start or gt the end.
// Mask each pixel based on the start and end images.
imageCollection = imageCollection.map(function(image){
var dateBand = ee.Image(image.date().millis());
image = image.updateMask(dateBand.gte(randomStarts))
.updateMask(dateBand.lte(randomEnds));
return image.addBands(dateBand.rename('dateMillis'));
});
Add the result to the map and use the inspector tool to check that pixels outside the daterange are masked.
// Add sample image to the map (note that zoom will change the values as the random images
// do not have a projection).
Map.addLayer(randomStarts)
Map.addLayer(randomEnds)
Map.addLayer(imageCollection.filterDate('2018','2019').first().select(['B4','B3','B2','dateMillis']),
{bands: ['B4','B3','B2'], min: 0, max: 0.35}, 'sample image');
Link to reproducible example