{"id":13448533,"url":"https://github.com/PeterHdd/date-filtersjs","last_synced_at":"2025-03-22T09:31:26.093Z","repository":{"id":98242826,"uuid":"188737106","full_name":"PeterHdd/date-filtersjs","owner":"PeterHdd","description":"A typescript library to help developers in filtering according to specific date range","archived":false,"fork":false,"pushed_at":"2021-08-24T06:54:23.000Z","size":24,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T10:07:02.152Z","etag":null,"topics":["javascript","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PeterHdd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"patreon":"peterhaddad","custom":"https://www.buymeacoffee.com/peterhaddad"}},"created_at":"2019-05-26T22:19:34.000Z","updated_at":"2023-04-28T16:29:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"8db8e628-897e-4cc6-92e9-fb05a105c6c9","html_url":"https://github.com/PeterHdd/date-filtersjs","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.08333333333333337,"last_synced_commit":"ca059dbf24ae0239c024789b423ba9a7573ea982"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterHdd%2Fdate-filtersjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterHdd%2Fdate-filtersjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterHdd%2Fdate-filtersjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterHdd%2Fdate-filtersjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PeterHdd","download_url":"https://codeload.github.com/PeterHdd/date-filtersjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937751,"owners_count":20535124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","typescript"],"created_at":"2024-07-31T05:01:48.228Z","updated_at":"2025-03-22T09:31:25.673Z","avatar_url":"https://github.com/PeterHdd.png","language":"TypeScript","readme":"# DATE-FILTERSJS - Combination of Filter and Date\n\n![Release](https://img.shields.io/github/release/peterhdd/date-filtersjs.svg)\n![Release Date](https://img.shields.io/github/release-date/peterhdd/date-filtersjs.svg)\n![Last Commit](https://img.shields.io/github/last-commit/peterhdd/date-filtersjs.svg)\n![License](https://img.shields.io/github/license/peterhdd/date-filtersjs.svg)\n\n## Introduction\n\nThis is a javascript library, the main purpose of this library is to easily apply filter on specific date range and apply filter on any attribute.\n\n## Installation\n\nTo build your project using Webpack or similar builders, install packages from NPM:\n\n```\nnpm i date-filtersjs\n```\nimport as follows:\n```js\nimport {Dates, DateFormat, Filter} from 'date-filtersjs';\n```\n\n## Usage\n\n### Example User object\n\n```js\nlet obj = [\n    {\n        \"name\" : \"userx\",\n        \"age\"  : \"20\",\n        \"date\" : \"05/25/2019\"\n    },\n    {\n        \"name\" : \"usery\",\n        \"age\"  : \"21\",\n        \"date\" : \"05/24/2019\"\n    },\n    {\n        \"name\" : \"userg\",\n        \"age\"  : \"21\",\n        \"date\" : \"05/31/2019\"\n    },\n    {\n        \"name\" : \"userz\",\n        \"age\"  : \"21\",\n        \"date\" : \"06/03/2019\"\n    },\n    {\n        \"name\" : \"userw\",\n        \"age\"  : \"21\",\n        \"date\" : \"26/05/2019\"\n    }\n];\n```\n\n### Filter\n\n```js\nlet filter = new Filter(obj);                                            // initialize filter\nfilter.filterBy(\"name\",\"userz\").result();                                // Filter by an attribute\nfilter.where(\"name\",\"==\",\"userz\").where(\"age\",\"==\",\"21\").result();       // compound filter (AND), valid operators that can be used (==, !=, \u003c= , \u003e=)\n\nfilter.filterByToday(\"date\").result();                                    // filters the date by today\nfilter.filterByYesterday(\"date\").result();                                // filters the date by yesterday\nfilter.filterByCurrentWeek(\"date\").result();                              // filters the date by first and last day of the week\nfilter.filterByCurrentMonth(\"date\").result();                             // filters the date by current month\nfilter.filterByNextWeek(\"date\").result();                                 // filters the date by next week\nfilter.filterByNextMonth(\"date\").result();                                // filters the date by next month\nfilter.filterByLastWeek(\"date\").result();                                 // filters the date by last week\n\nfilter.filterByNextThirtyDays(\"date\").result();                           // filters the date by next thirty days\nfilter.filterByLastSevenDays(\"date\").result();                            // filters the date by last seven days\nfilter.filterByLastThirtyDays(\"date\").result();                           // filters the date by last thirty days\nfilter.filterByLastSixtyDays(\"date\").result();                            // filters the date by last sixty days \n\nfilter.filterByLastNinetyDays(\"date\").result();                           // filters the date by last ninety days\nfilter.filterByMonthToDate(\"date\").result();                              // filters the date by month to date\nfilter.filterByLastMonth(\"date\").result();                                // filters the date by last month\n```\n**Note:** All of the above will return the filtered array\n\n### Date\n\nYou can also retrieve the date ranges, the following are the different methods available:\n\n```js\n\nlet date = new Dates();                                                  // initialize\ndate.setFormat(\"MM/DD/YYYY\");                                            // set the format, valid formats (\"MM/DD/YYYY\", \"MM-DD-YYYY\", \"DD/MM/YYYY\")\ndate.getFormat();                                                        // retrieve format\n\n// both methods below will return an object like this {date: \"26/05/2019\"}, you can access the date using \"date\" attribute\n\ndate.today();                                                           // retrieve today's date\ndate.yesterday();                                                       // retrieve yesterday's date\n\n// all methods below will return an object like this {first: \"26/05/2019\", last: \"01/06/2019\"}, you can access the first and last date by using \"first\" and \"last attribute\n\ndate.currentWeek();                                                     // retrieve first and last day of the week\ndate.currentMonth();                                                    // retrieve first and last day of the month\ndate.nextWeek();                                                        // retrieve first and last day of next week\n\ndate.nextMonth();                                                       // retrieve first and last day of next month\ndate.lastWeek();                                                        // retrieve first and last day of last week\ndate.nextThirtyDays();                                                  // retrieve first and last day of the next thirty days\n\ndate.lastSevenDays();                                                   // retrieve first and last day of last seven days\ndate.lastThirtyDays();                                                  // retrieve first and last day of last thirty days\ndate.lastSixtyDays();                                                   // retrieve first and last day of the last sixty days\n\ndate.lastNinetyDays();                                                  // retrieve first and last day of the last ninety days\ndate.monthToDate();                                                     // retrieve first day of the month and current day\ndate.lastMonth();                                                       // retrieve first and last day of last month\n\ndate.incrementBy(\"40\"));                                                // retrieve current day and last day according to the increment number provided\ndate.decrementBy(\"40\"));                                                // retrieve current day and last day according to the decrement number provided\n```\n\n### Created \u0026 Maintained By\n\n[Peter](https://github.com/peterhdd) ([@peterndev](https://www.twitter.com/peterndev))\n\nIf you found this extension helpful and want to thank me, consider buying me a cup of :coffee:\n\n\u003ca href=\"https://www.buymeacoffee.com/peterhaddad\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-red.png\" alt=\"Buy Me A Coffee\" height= \"45px\" width=\"174px\"\u003e\u003c/a\u003e\n\n","funding_links":["https://patreon.com/peterhaddad","https://www.buymeacoffee.com/peterhaddad"],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPeterHdd%2Fdate-filtersjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPeterHdd%2Fdate-filtersjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPeterHdd%2Fdate-filtersjs/lists"}