{"id":16499450,"url":"https://github.com/tpapp/flexdates.jl","last_synced_at":"2026-03-18T20:03:07.512Z","repository":{"id":55588560,"uuid":"107414202","full_name":"tpapp/FlexDates.jl","owner":"tpapp","description":"Dates with arbitrary integer types and epochs.","archived":false,"fork":false,"pushed_at":"2020-12-20T09:14:55.000Z","size":22,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-20T20:04:51.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-18T13:45:34.000Z","updated_at":"2023-01-24T13:28:56.000Z","dependencies_parsed_at":"2022-08-15T03:50:21.617Z","dependency_job_id":null,"html_url":"https://github.com/tpapp/FlexDates.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tpapp/FlexDates.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FFlexDates.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FFlexDates.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FFlexDates.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FFlexDates.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpapp","download_url":"https://codeload.github.com/tpapp/FlexDates.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FFlexDates.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30091570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T19:41:02.502Z","status":"ssl_error","status_checked_at":"2026-03-04T19:40:05.550Z","response_time":59,"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-10-11T14:52:57.259Z","updated_at":"2026-03-04T20:02:24.632Z","avatar_url":"https://github.com/tpapp.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FlexDates\n\n![Lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)\n[![Build Status](https://travis-ci.org/tpapp/FlexDates.jl.svg?branch=master)](https://travis-ci.org/tpapp/FlexDates.jl)\n[![Coverage Status](https://coveralls.io/repos/github/tpapp/FlexDates.jl/badge.svg?branch=master)](https://coveralls.io/github/tpapp/FlexDates.jl?branch=master)\n[![codecov.io](http://codecov.io/github/tpapp/FlexDates.jl/coverage.svg?branch=master)](http://codecov.io/github/tpapp/FlexDates.jl?branch=master)\n\n\n## Motivation\n\nJulia `Date`s in the standard library `Dates` represent a particular day counting from `0001-01-01` as the first day, using `Int64`. This allows the user to use dates in the interval of ±2.5e16 years, starting well before the Big Bang, and continuing way after the sun dies.\n\nFor the modest needs of social science data, a more limited range is\noften sufficient. For example, `Int16` can represent days spanning a\nbit more than 179 years (`2^16/365`), while `Int32` works for a bit\nmore than 10 million years.\n\nThis package helps with the management of dates, relying on `Dates` to do most of the tricky bits of date calculations. The main type in this package, `FlexDate`, is intended primarily as a *storage* format: using more compact dates, you can economize on memory and disk consumption.\n\n## Installation\n\nThe package is not (yet) registered. Install with\n\n```julia\npkg\u003e add https://github.com/tpapp/FlexDates.jl\n```\n\n## Usage\n\nYou need to choose an *epoch*, a particular date we count from. This is incorporated into the type: Julia's zero cost abstraction ensures that there is no storage overhead when values are unboxed (eg arrays). The second type parameter for `FlexDate` is the integer type for internal representation. Constructors accept dates, `year, month, day`, or a single integer counting the number of days.\n\nThe following constructors are equivalent:\n```julia\nusing FlexDates\n\njulia\u003e FlexDate{Date(2000,1,1), Int16}(Date(1980, 1, 1))\n1980-01-01 [2000-01-01 + Int16 days]\n\njulia\u003e FlexDate{Date(2000,1,1), Int16}(1980, 1, 1)\n1980-01-01 [2000-01-01 + Int16 days]\n\njulia\u003e FlexDate{Date(2000,1,1)}(Int16(-7305))\n1980-01-01 [2000-01-01 + Int16 days]\n```\n\nWhen working with a dataset, it is recommended that you define a type constant:\n```julia\nconst MyDate = FlexDate{Date(2000,1,1), Int16}\n\nMyDate(1980, 1, 1)\n```\n\nLimited arithmetic and comparisons are supported. Keep in mind that these operations will be fast when you use dates with the *same epoch*, otherwise dates will be converted back to `Date` for calculations. A single dataset should use a single epoch unless there is a compelling reason to do otherwise.\n\nFor sophisticated arithmetic and date calculations, convert to `Date`, since `FlexDate` is meant primarily as a storage format.\n\nFor timespans, it is recommended that you use\n[DiscreteRanges.jl](https://github.com/tpapp/DiscreteRanges.jl):\n\n```julia\njulia\u003e using DiscreteRanges\n\njulia\u003e MyDate(2003, 4, 8) ∈ MyDate(2001, 1, 1)..MyDate(2010, 1, 1)\ntrue\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpapp%2Fflexdates.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpapp%2Fflexdates.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpapp%2Fflexdates.jl/lists"}