{"id":18663144,"url":"https://github.com/damiansire/date-wizard-pro","last_synced_at":"2025-04-11T21:32:00.723Z","repository":{"id":241451596,"uuid":"805634233","full_name":"damiansire/date-wizard-pro","owner":"damiansire","description":" DateWizard: Your JavaScript Time Wizard! 🧙‍♂️ Simplify date manipulation \u0026 formatting. Add/subtract days, customize formats (\"dd-mm-yyyy\", etc.). Lightweight \u0026 perfect for all skill levels.","archived":false,"fork":false,"pushed_at":"2024-06-09T21:33:34.000Z","size":71,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T19:08:21.376Z","etag":null,"topics":["date","javascript","javascript-library","library","npm","npm-package","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damiansire.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-25T03:21:10.000Z","updated_at":"2024-11-09T21:33:08.000Z","dependencies_parsed_at":"2024-06-08T20:06:33.861Z","dependency_job_id":null,"html_url":"https://github.com/damiansire/date-wizard-pro","commit_stats":null,"previous_names":["damiansire/date-wizard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fdate-wizard-pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fdate-wizard-pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fdate-wizard-pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fdate-wizard-pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damiansire","download_url":"https://codeload.github.com/damiansire/date-wizard-pro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248483043,"owners_count":21111419,"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":["date","javascript","javascript-library","library","npm","npm-package","typescript","typescript-library"],"created_at":"2024-11-07T08:15:20.139Z","updated_at":"2025-04-11T21:32:00.446Z","avatar_url":"https://github.com/damiansire.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DateWizard 🧙‍♂️\r\n\r\nDateWizard is a simple yet powerful TypeScript library designed to make date manipulation in your JavaScript projects a breeze. With a straightforward API, you can easily add or subtract days, and format dates to your liking.\r\n\r\n## Features\r\n\r\n- **Intuitive API:** Work with dates in a way that feels natural and easy to understand.\r\n- **Customizable Formatting:** Format dates using \"dd-mm-yyyy\", \"yyyy-mm-dd\", or any other format you desire.\r\n- **Easy Date Manipulation:** Add or subtract days with simple methods.\r\n- **Lightweight:** Add DateWizard to your projects without bloating their size.\r\n- **TypeScript Support:** Enjoy the benefits of type safety and improved code maintainability.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install date-wizard-pro\r\n```\r\n\r\n## Usage\r\n\r\n### Instance Methods:\r\n\r\n```javascript\r\nimport DateWizard from \"date-wizard-pro\";\r\n\r\n// Create a DateWizard instance for a specific date\r\nconst myDate = new DateWizard(\"12-25-2024\"); // Christmas 2024\r\n\r\n// Get the formatted date in different ways\r\nmyDate.getString(); // \"2024-12-25\"\r\nmyDate.getString(\"dd-mm-yyyy\"); // 25-12-2024\r\nmyDate.getString(\"mm-dd-yyyy\"); // 12-25-2024\r\nmyDate.getString(\"dd/mm/yyyy\"); // 25/12/2024\r\nmyDate.getString(\"mm/dd/yyyy\"); // 12/25/2024\r\n\r\n// Modify the date: subtract Days\r\nconst result1 = myDate.subtractDays(10);\r\nconsole.log(result1); // \"2024-12-15\"\r\nmyDate.getString(); // \"2024-12-15\"\r\n\r\n// Modify the date: add Days\r\nconst result2 = myDate.addDays(2);\r\nconsole.log(result2); // \"2024-12-17\"\r\nmyDate.getString(); // \"2024-12-17\"\r\n\r\n// toDate()\r\nconst jsDate = myDate.toDate();\r\nconsole.log(jsDate); // JavaScript Date object (2024-12-17T00:00:00.000Z)\r\n```\r\n\r\n### Static Methods:\r\n\r\n```javascript\r\nimport DateWizard from \"date-wizard-pro\";\r\n\r\n// DateWizard.addDays()\r\nDateWizard.getTodayDate(); // \"28-05-2024\"\r\nDateWizard.getTodayDate(\"mm/dd/yyyy\"); // \"05/28/2024\"\r\nDateWizard.getTodayDate(\"mm-dd-yyyy\"); // \"05-28-2024\"\r\n\r\n// DateWizard.addDays()\r\nDateWizard.addDays(\"12-25-2023\", 7); // \"01-01-2024\"\r\n\r\n// DateWizard.subtractDays()\r\nconst pastDate = DateWizard.subtractDays(\"12-25-2023\", 10); // \"12-15-2023\"\r\n\r\n// DateWizard.getString()\r\nconst formattedDate = DateWizard.getString(\"12-25-2023\", \"yyyy-mm-dd\"); //\"2023-12-25\"\r\n```\r\n\r\n## API\r\n\r\n### Instance Methods:\r\n\r\n#### `new DateWizard(dateString: string)`\r\n\r\nCreates a new `DateWizard` instance. `dateString` should be in the format \"dd-mm-yyyy\".\r\n\r\n#### `addDays(days: number): string`\r\n\r\nAdds the specified number of `days` to the date and returns the result as a formatted string in the default format (\"dd-mm-yyyy\").\r\n\r\n#### `subtractDays(days: number): string`\r\n\r\nSubtracts the specified number of `days` from the date and returns the result as a formatted string in the default format (\"dd-mm-yyyy\").\r\n\r\n#### `toDate(): Date`\r\n\r\nConverts the `DateWizard` instance to a native JavaScript `Date` object.\r\n\r\n#### `getString(formatString = \"dd-mm-yyyy\"): string`\r\n\r\nReturns the date as a formatted string. The `formatString` argument can be customized (e.g., \"yyyy-mm-dd\", \"mm/dd/yyyy\").\r\n\r\n### Static Methods\r\n\r\n#### `DateWizard.getTodayDate(formatString = \"dd-mm-yyyy\"): string`\r\n\r\nThis static function allows you to easily retrieve the current date formatted according to your preferences.\r\n\r\n- Returns today's date in the format specified by `formatString`.\r\n- If no `formatString` is provided, the default format \"dd-mm-yyyy\" (day-month-year) is used.\r\n\r\n**Example:**\r\n\r\n```javascript\r\nconst today = DateWizard.getTodayDate();\r\nconst usDate = DateWizard.getTodayDate(\"mm/dd/yyyy\");\r\n```\r\n\r\n#### `DateWizard.addDays(dateString: string, days: number): string`\r\n\r\nAdds the specified number of `days` to the given `dateString` and returns the result as a formatted string in the default format (\"dd-mm-yyyy\").\r\n\r\n#### `DateWizard.subtractDays(dateString: string, days: number): string`\r\n\r\nSubtracts the specified number of `days` from the given `dateString` and returns the result as a formatted string in the default format (\"dd-mm-yyyy\").\r\n\r\n#### `DateWizard.getString(dateString: string, formatString = \"dd-mm-yyyy\"): string`\r\n\r\nReturns the given `dateString` formatted according to the specified `formatString`. If no `formatString` is provided, the default format (\"dd-mm-yyyy\") is used.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! If you have suggestions or find any issues, please feel free to open an issue or submit a pull request.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiansire%2Fdate-wizard-pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamiansire%2Fdate-wizard-pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiansire%2Fdate-wizard-pro/lists"}