{"id":13768543,"url":"https://github.com/madztheo/noir-date","last_synced_at":"2026-04-13T08:02:51.257Z","repository":{"id":213149343,"uuid":"733117765","full_name":"madztheo/noir-date","owner":"madztheo","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-14T19:14:05.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T21:22:53.807Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Noir","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/madztheo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-18T15:49:35.000Z","updated_at":"2025-09-14T19:13:52.000Z","dependencies_parsed_at":"2025-09-14T21:11:25.541Z","dependency_job_id":"fba57848-cf82-4922-bf5f-aa7effb30536","html_url":"https://github.com/madztheo/noir-date","commit_stats":null,"previous_names":["madztheo/noir-date"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/madztheo/noir-date","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madztheo%2Fnoir-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madztheo%2Fnoir-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madztheo%2Fnoir-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madztheo%2Fnoir-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madztheo","download_url":"https://codeload.github.com/madztheo/noir-date/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madztheo%2Fnoir-date/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31744404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-03T16:01:22.677Z","updated_at":"2026-04-13T08:02:51.247Z","avatar_url":"https://github.com/madztheo.png","language":"Noir","funding_links":[],"categories":["Libraries","Get Coding"],"sub_categories":["Data Types","Libraries"],"readme":"# Noir Date\n\n## Description\n\nThis library makes it easier to use date in Noir.\n\n## Installation\n\nIn your Nargo.toml file, add the following dependency:\n\n```\n[dependencies]\ndate = { tag = \"v0.5.4\", git = \"https://github.com/madztheo/noir-date.git\" }\n```\n\n### Import the library\n\nAdd this line to the top of your Noir file:\n\n```rust\nuse dep::date::Date;\n```\n\n## Usage\n\n### Initialize a Date\n\n```rust\n// December 19, 2023\nlet date = Date::new(2023, 12, 19);\n\n// Or alternatively from a string following this format yyyyMMdd\nlet date = Date::from_str_long_year(\"20231219\");\n\n// Or even from a byte representation of a ASCII string\nlet date = Date::from_bytes_long_year([50, 48, 50, 51, 49, 50, 49, 57]);\n```\n\n### Get the duration in days between two dates\n\n```rust\nlet date1 = Date::new(2023, 10, 2);\n\nlet date2 = Date::new(2023, 12, 20);\n\n// date2 - date1\nlet duration = date2.get_duration_in_days(date1, false);\nassert(duration == 79);\n```\n\n### Add years to a date\n\n```rust\nlet date = Date::new(2023, 10, 2);\n\nlet date = date.add_years(2);\nassert(date.eq(Date::new(2025, 10, 2)));\n```\n\n### Add months to a date\n\n```rust\nlet date = Date::new(2023, 10, 2);\n\nlet date = date.add_months(3);\n\nassert(date.eq(Date::new(2024, 1, 2)));\n```\n\n### Add days to a date\n\n```rust\nlet date = Date::new(2023, 10, 2);\n\nlet date = date.add_days(3);\n\nassert(date.eq(Date::new(2023, 10, 5)));\n```\n\n### Check if a date is a leap year\n\n```rust\nlet leap_year = Date::new(2024, 1, 1);\n\nassert(leap_year.is_leap_year());\n\nlet not_leap_year = Date::new(2023, 1, 1);\n\nassert(!not_leap_year.is_leap_year());\n```\n\n### Compare dates\n\n```rust\nlet date1 = Date::new(2023, 10, 2);\n\nlet date2 = Date::new(2023, 12, 20);\n\nassert(date1.lt(date2));\nassert(date2.gt(date1));\n```\n\n### Check someone's age is above 18 years old\n\n```rust\nlet birthdate = Date::new(1993, 3, 6);\n\nlet current_date = Date::new(2023, 12, 20);\n\nassert(current_date.gte(birthdate.add_years(18)));\n```\n\n## Notes\n\nThis library is still in development. At the moment, there is a known bug related to comparisons with negative and positive numbers that has been fixed in the version 0.22.0 of Noir. So please install the latest nightly version of Noir to use this library.\nIf you find any other bugs, please report them in the issues section of this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadztheo%2Fnoir-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadztheo%2Fnoir-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadztheo%2Fnoir-date/lists"}