{"id":27158907,"url":"https://github.com/activecollab/datevalue","last_synced_at":"2025-06-29T15:04:49.777Z","repository":{"id":56940236,"uuid":"44009644","full_name":"activecollab/datevalue","owner":"activecollab","description":"Simple extension to Carbon that makes distinction between date and date-time objects","archived":false,"fork":false,"pushed_at":"2022-08-10T07:30:29.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-12T02:19:45.245Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"httsp://labs.activecollab.com","language":"PHP","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/activecollab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-10T12:24:45.000Z","updated_at":"2022-08-10T06:29:20.000Z","dependencies_parsed_at":"2022-08-21T06:20:48.739Z","dependency_job_id":null,"html_url":"https://github.com/activecollab/datevalue","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/activecollab/datevalue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activecollab%2Fdatevalue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activecollab%2Fdatevalue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activecollab%2Fdatevalue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activecollab%2Fdatevalue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/activecollab","download_url":"https://codeload.github.com/activecollab/datevalue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activecollab%2Fdatevalue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262614456,"owners_count":23337277,"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":[],"created_at":"2025-04-08T22:39:26.710Z","updated_at":"2025-06-29T15:04:49.722Z","avatar_url":"https://github.com/activecollab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DateValue\n\n[![Build Status](https://travis-ci.org/activecollab/datevalue.svg?branch=master)](https://travis-ci.org/activecollab/datevalue)\n\nSimple extension to Carbon that makes distinction between date and date-time objects. In order to create a date object, write:\n\n```php\n\u003c?php\n\nnamespace MyApp;\n\nuse ActiveCollab\\DateValue\\DateValue;\n\n$date = new DateValue('last day of April 2017');\nprint $date-\u003eformat('Y-m-d') . \"\\n\";\n```\n\nIn order to create a date and time object, create a `DateTimeValue` instance:\n\n```php\n\u003c?php\n\nnamespace MyApp;\n\nuse ActiveCollab\\DateValue\\DateTimeValue;\n\n$date_time = new DateTimeValue('last day of April 2017');\nprint $date_time-\u003eformat('Y-m-d H:i:s') . \"\\n\";\n```\n\nSince both DateValue, and DateTimeValue classes extend Carbon, you can also use all Carbon methods in your code:\n\n```php\n\u003c?php\n\nnamespace MyApp;\n\nuse ActiveCollab\\DateValue\\DateTimeValue;\n\n$date_time = (new DateTimeValue('last day of April 2017'))-\u003eendOfDay();\nprint $date_time-\u003eformat('Y-m-d H:i:s') . \"\\n\";\n```\n\nTo specify a date range, use DateRange class. Ranges can be easily iterated:\n\n```php\n\u003c?php\n\nnamespace MyApp;\n\nuse ActiveCollab\\DateValue\\DateRange;\nuse ActiveCollab\\DateValue\\DateValue;\nuse ActiveCollab\\DateValue\\DateValueInterface;\n\n$first_day = new DateValue('first day of April 2017');\n$last_day = new DateValue('last day of April 2017');\n\n$date_range = new DateRange($first_day, $last_day);\n\n/** @var DateValueInterface $day */\nforeach ($date_range as $day) {\n    $this-\u003eassertInstanceOf(DateValueInterface::class, $day);\n    print $day-\u003eformat('Y-m-d') . \"\\n\"; // Prints all days from 2017-04-01 to 2017-04-30.\n}\n```\n\nThere are three helper date range classes:\n\n```php\n\u003c?php\n\nnamespace MyApp;\n\nuse ActiveCollab\\DateValue\\DateRange\\MonthDateRange;\nuse ActiveCollab\\DateValue\\DateRange\\QuarterDateRange;\nuse ActiveCollab\\DateValue\\DateRange\\YearDateRange;\n\nnew MonthDateRange(2017, 4); // April 2017.\nnew QuarterDateRange(2017, 2); // Q2 2017.\nnew YearDateRange(2017); // The whole 2017.\n```\n\nThese ranges automatically calculate start and end dates, and they can be iterated, just like custom date ranges.\n\n## Version 2\n\nGoals of second iteration of this package are:\n\n* [x] Make the package require PHP 7.1, and use strict types in all files,\n* [x] Make the library 100% covered with tests,\n* [x] Add support for custom date ranges, as well as year, quarter, month, and day ranges,\n* [x] Add support for easy looping in date ranges.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivecollab%2Fdatevalue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factivecollab%2Fdatevalue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivecollab%2Fdatevalue/lists"}