Skip to content

Commit 43945e2

Browse files
committed
Add ability to browse expired posts
1 parent 1a73708 commit 43945e2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/JobsFilter.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import filterJobs from '../filter-jobs.js';
1111

1212
const defaultFormValues = {
1313
fullTime: false,
14-
ossTimeGt: 0
14+
ossTimeGt: 0,
15+
showExpired: false
1516
};
1617

1718
const JobsFilter = () => {
@@ -33,6 +34,11 @@ const JobsFilter = () => {
3334
<input type="checkbox" {...register('fullTime')} />
3435
Full-time
3536
</label>
37+
<label>
38+
<input type="checkbox" {...register('showExpired')} />
39+
Expired
40+
</label>
41+
3642

3743
<div className="section">
3844
Open Source

src/filter-jobs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const filterJobs = (jobs, filter) => {
22
// Filter out expired jobs. Use Howland Island timezone to ensure
33
// that everyone sees the job on its last day.
44
const today = new Date();
5-
jobs = jobs.filter((job) => new Date(`${job.expires}T23:59:59.999-12:00`) > today);
5+
if (!filter.showExpired) {
6+
jobs = jobs.filter((job) => new Date(`${job.expires}T23:59:59.999-12:00`) > today)
7+
}
68

79
if (filter.fullTime) {
810
jobs = jobs.filter((job) => job.percentTime === 100)

0 commit comments

Comments
 (0)