# Help filter a list by date range

**URL:** <https://forum.code.org/t/help-filter-a-list-by-date-range/40463>\
**Category:** CS Principles\
**Created:** [February 26, 2025, 8:56pm UTC](https://forum.code.org/t/help-filter-a-list-by-date-range/40463 "2025-02-26T20:56:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marleisy](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@marleisy](https://forum.code.org/u/marleisy)\
**Post date:** [February 26, 2025, 8:56pm UTC](https://forum.code.org/t/help-filter-a-list-by-date-range/40463/1 "2025-02-26T20:56:45Z")

</div>

> **[Check out what I made](https://studio.code.org/projects/applab/wOTm93D9k69HuWuSf1tM8uFN0SFFNArrGrnodLuBOew)**
>
> I wrote the code myself with Code.org

Student is looking for a way to filter the data in a column by a range of dates (eg. 1980-1989) rather than by a single value (eg. 1980). Is there a simple way of doing this?

The student is trying to create a conditional to do the task, but this is not working. I can see that there is a disconnect between the input variable (line 12) and the filtering of lists beginning on line 23, but I’m not sure how to help him resolve the issue and accomplish the filtering goal.

Thank you

---

<div class="post-metadata">

**Author:** ![varrience](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/varrience/32/8042_2.png) [@varrience](https://forum.code.org/u/varrience)\
**Post date:** [February 26, 2025, 9:05pm UTC](https://forum.code.org/t/help-filter-a-list-by-date-range/40463/2 "2025-02-26T21:05:41Z")

</div>

I’d recommend `Array.prototype.sort` or `[].sort()` for short you can find documentation about the specifics here [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Array/sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) feel free to update the thread if you still are not able to resolve it even with the documentation i have given you

# Varrience

---

<div class="post-metadata">

**Author:** ![bhatnagars](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/bhatnagars/32/4919_2.png) [@bhatnagars](https://forum.code.org/u/bhatnagars)\
**Post date:** [February 27, 2025, 10:36pm UTC](https://forum.code.org/t/help-filter-a-list-by-date-range/40463/4 "2025-02-27T22:36:06Z")

</div>

Please confirm that this project is not part of the Create PT submission. As you know students cannot get any help on their Create PT except from a collaborative partner. Once you confirm, I can give some suggestions on how to approach the problem.
