{"id":19606259,"url":"https://github.com/toburger/datetypeprovider","last_synced_at":"2026-05-17T15:02:29.610Z","repository":{"id":145182624,"uuid":"22210091","full_name":"toburger/DateTypeProvider","owner":"toburger","description":"F# date type provider which provides strong type checking for dates.","archived":false,"fork":false,"pushed_at":"2018-05-28T17:43:34.000Z","size":121,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-16T04:17:09.565Z","etag":null,"topics":["date","datetime","dotnet","dotnet-core","dotnet-standard","fsharp","nodatime","typeprovider"],"latest_commit_sha":null,"homepage":null,"language":"F#","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/toburger.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}},"created_at":"2014-07-24T11:12:53.000Z","updated_at":"2018-07-25T16:37:44.000Z","dependencies_parsed_at":"2023-04-10T18:47:19.818Z","dependency_job_id":null,"html_url":"https://github.com/toburger/DateTypeProvider","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/toburger/DateTypeProvider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toburger%2FDateTypeProvider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toburger%2FDateTypeProvider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toburger%2FDateTypeProvider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toburger%2FDateTypeProvider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toburger","download_url":"https://codeload.github.com/toburger/DateTypeProvider/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toburger%2FDateTypeProvider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274935950,"owners_count":25376832,"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-09-13T02:00:10.085Z","response_time":70,"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":["date","datetime","dotnet","dotnet-core","dotnet-standard","fsharp","nodatime","typeprovider"],"created_at":"2024-11-11T10:04:00.415Z","updated_at":"2025-11-02T17:02:22.557Z","avatar_url":"https://github.com/toburger.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"DateTypeProvider\n================\n\n[![Build status](https://ci.appveyor.com/api/projects/status/nsf7rnpoesi37oi4?svg=true)](https://ci.appveyor.com/project/toburger/datetypeprovider)\n[![NuGet Badge](https://buildstats.info/nuget/FSharp.DateTypeProvider)](https://www.nuget.org/packages/FSharp.DateTypeProvider/)\n\nF# Date Type Provider which provides strong type checking for dates.\n\nReason for the Type Provider\n----------------------------\n\nAfter watching [this video](https://vimeo.com/97349221) from Scott Meyers\nwhere he showed an example of a strongly typed datetime class\nI thought this is a good fit for an F# Type Provider.\n\nExample\n-------\n```fsharp\nopen DateProvider\n\n// dates can be represented with month digits\nDate.``2004``.``02``.``29``.ToDateTime()\n// or with month names\nDate.``2004``.February.``29``.ToDateTime()\n\n// does not compile\nDate.``2002``.``13``.``10``.ToDateTime()\nDate.``2002``.``02``.``29``.ToDateTime()\n\n// you can also return a DateTimeOffset\nDate.``2002``.``13``.``10``.ToDateTimeOffset()\n\n// you can also provide a century parameter\ntype C21 = Date\u003ccentury = Century.``21``\u003e // returns years from 2001 to 2100\nprintfn \"%A\" \u003c| C21.``2012``.November.``01``.ToDateTime()\n\ntype C18 = Date\u003ccentury = Century.``18``\u003e // returns years from 1701 to 1800\nprintfn \"%A\" \u003c| C18.``1789``.July.``14``.ToDateTime()\n\n// you can force a century even if it is not defined in the enum\nlet [\u003cLiteral\u003e] c80: Century = enum 80\ntype C80 = Date\u003ccentury = c80\u003e\nprintfn \"%A\" \u003c| C80.``7908``.July.``14``.ToDateTime()\n\n// providing a Century value which is not in the valid range (1 to 99) the provider falls back to the current century\nlet [\u003cLiteral\u003e] c100: Century = enum 100\ntype C100 = Date\u003ccentury = c100\u003e\nprintfn \"%A\" \u003c| C100.``2004``.July.``14``.ToDateTime()\n```\n\nWorking with NodaTime\n---------------------\n\nThe Type Provider returns a ```Date``` record with the Fields ```Year```, ```Month``` and ```Day```. You can call the methods ```ToDateTime()``` and ```ToDateTimeOffset(?offset)``` to return a ```DateTime``` or a ```DateTimeOffset```.    \nLikewise you can write your own extension method to return a [NodaTime](http://nodatime.org/) ```LocalDate```.\n\n\n```fsharp\nopen NodaTime\n\ntype FSharp.DateTypeProvider.Date with\n    member self.ToLocalDate() =\n        LocalDate(self.Year, self.Month, self.Day)\n\nprintfn \"%A\" \u003c| Date.``2013``.February.``01``.ToLocalDate()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoburger%2Fdatetypeprovider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoburger%2Fdatetypeprovider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoburger%2Fdatetypeprovider/lists"}