This project is read-only.

Manipulate the selector of an inner join


I create a dateRange wich is an array of dates.

Then I have an array of day numbers like 0 for Sunday, 1 for Monday etc...

Now I want to get all dateRange dates according to the visibleWeekDays array.

The solution is in the getVisibleDateRange function.

But I want to do it with LINQ because why reinvent the wheel...

The inner or outer selector would still need a .day() because one of the selector is a momentJS object.

But to get the day of week I would need to put the ".day()" into the linqJS string which can not work...

What would be your solution with linqJS ?
// Arrange
var startDate = moment(new Date(2014, 1, 1));
var endDate = moment(new Date(2014, 1, 15));
var visibleWeekDays = [0,1]

// Act
var dates = dateFactory.dateRange(startDate, endDate);

var visibleDays = dateFactory.getVisibleDateRange(visibleWeekDays ,dates);

 function getVisibleDateRange(visibleWeekDays, dateRange) {
        var visibleDateRange = [];
        for (var i = 0; i < dateRange.length; i++) {
            for (var j = 0; j < visibleWeekDays.length; j++) {
                var currentDate = dateRange[i];
                var dayOfWeek =;
                var visibleDayOfWeek = visibleWeekDays[j];
                if (visibleDayOfWeek === dayOfWeek) {
        return visibleDateRange;

    var visibleDateRange = Enumerable.from(visibleWeekDays).join(dateRange,"","","outer,inner=>outer + ':' + inner")