{"id":15008553,"url":"https://github.com/westy92/const-date-time","last_synced_at":"2025-07-24T18:13:32.693Z","repository":{"id":62194451,"uuid":"558647085","full_name":"westy92/const-date-time","owner":"westy92","description":"A drop-in replacement for Dart's DateTime class with a const constructor.","archived":false,"fork":false,"pushed_at":"2024-12-28T22:57:08.000Z","size":218,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T16:05:09.546Z","etag":null,"topics":["const","constructor","constructors","dart","dart-lang","dart-library","dart-package","dart2","dartlang","datetime","flutter","flutter-package","flutter-plugin"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/const_date_time","language":"Dart","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/westy92.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["westy92"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-10-28T01:27:12.000Z","updated_at":"2024-12-28T22:57:12.000Z","dependencies_parsed_at":"2023-02-09T14:16:04.893Z","dependency_job_id":"b77c13ad-3a2c-4087-9b26-a2248f02f97a","html_url":"https://github.com/westy92/const-date-time","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":0.5,"last_synced_commit":"36b03455803c0dbc70f68bd46e96e5577c3ef6a6"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/westy92/const-date-time","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westy92%2Fconst-date-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westy92%2Fconst-date-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westy92%2Fconst-date-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westy92%2Fconst-date-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/westy92","download_url":"https://codeload.github.com/westy92/const-date-time/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/westy92%2Fconst-date-time/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266886030,"owners_count":24001041,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["const","constructor","constructors","dart","dart-lang","dart-library","dart-package","dart2","dartlang","datetime","flutter","flutter-package","flutter-plugin"],"created_at":"2024-09-24T19:19:21.005Z","updated_at":"2025-07-24T18:13:32.625Z","avatar_url":"https://github.com/westy92.png","language":"Dart","readme":"# const_date_time\n\n[![Build Status](https://github.com/westy92/const-date-time/actions/workflows/github-actions.yml/badge.svg)](https://github.com/westy92/const-date-time/actions/workflows/github-actions.yml?query=branch%3Amain)\n[![Code Coverage](https://codecov.io/gh/westy92/const-date-time/branch/main/graph/badge.svg)](https://codecov.io/gh/westy92/const-date-time)\n[![Funding Status](https://img.shields.io/github/sponsors/westy92)](https://github.com/sponsors/westy92)\n\nA drop-in replacement for Dart's `DateTime` class with `const` constructors.\n\n## Getting started\n\nInstall the package:\n\n```bash\nflutter pub add const_date_time\n```\n\nor\n\n```bash\ndart pub add const_date_time\n```\n\n## Usage\n\nYou can use a `ConstDateTime` anywhere a `DateTime` is expected. All major `DateTime` constructors have a `const` version.\n\n```dart\nimport 'package:const_date_time/const_date_time.dart';\n\n// const constructors\nfinal year = const ConstDateTime(2022);\nfinal date = const ConstDateTime(2022, 10, 27);\nfinal dateTime = const ConstDateTime(2022, 10, 27, 12, 34, 56, 789, 10);\n\nfinal yearUtc = const ConstDateTime.utc(2022);\nfinal dateUtc = const ConstDateTime.utc(2022, 10, 27);\nfinal dateTimeUtc = const ConstDateTime.utc(2022, 10, 27, 12, 34, 56, 789, 1011);\n\nfinal ms = const ConstDateTime.fromMillisecondsSinceEpoch(1666931562000);\nfinal msUtc = const ConstDateTime.fromMillisecondsSinceEpoch(1666931562000, isUtc: true);\n\nfinal us = const ConstDateTime.fromMicrosecondsSinceEpoch(1666931562000000);\nfinal usUtc = const ConstDateTime.fromMicrosecondsSinceEpoch(1666931562000000, isUtc: true);\n```\n\nYou can access the underlying `DateTime` object directly:\n\n```dart\nfinal cdt = const ConstDateTime(2022);\nfinal DateTime dt = cdt.dateTime;\n// other getters are available as well:\nfinal int dtYear = dt.year;\nfinal int dtWeekday = dt.weekday;\n```\n\nDon't forget other `DateTime` methods too!\n\n```dart\nfinal constDateTime = const ConstDateTime(2022);\n\nconstDateTime.add(Duration(minutes: 5));\nconstDateTime.toIso8601String();\n```\n\nYou can convert a `DateTime` to a `ConstDateTime`.\n\n```dart\nfinal dateTime = DateTime(2024);\nfinal ConstDateTime constDateTime = dateTime.toConstDateTime();\n```\n\n## Sponsor\n\nPlease consider [sponsoring my work](https://github.com/sponsors/westy92) to ensure this library receives the attention it deserves.\n\n## License\n\nconst_date_time is released under the MIT License.\n","funding_links":["https://github.com/sponsors/westy92"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesty92%2Fconst-date-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesty92%2Fconst-date-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesty92%2Fconst-date-time/lists"}