{"id":21177440,"url":"https://github.com/betsol/angular-input-date","last_synced_at":"2025-03-14T18:29:07.168Z","repository":{"id":16201306,"uuid":"18948103","full_name":"betsol/angular-input-date","owner":"betsol","description":"AngularJS directive to enable support for date input type","archived":false,"fork":false,"pushed_at":"2015-05-27T08:04:31.000Z","size":359,"stargazers_count":38,"open_issues_count":2,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-20T19:05:53.239Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betsol.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-19T18:41:34.000Z","updated_at":"2019-03-23T13:02:34.000Z","dependencies_parsed_at":"2022-09-11T07:01:19.058Z","dependency_job_id":null,"html_url":"https://github.com/betsol/angular-input-date","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fangular-input-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fangular-input-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fangular-input-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fangular-input-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betsol","download_url":"https://codeload.github.com/betsol/angular-input-date/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243624766,"owners_count":20321158,"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":"2024-11-20T17:16:04.696Z","updated_at":"2025-03-14T18:29:07.112Z","avatar_url":"https://github.com/betsol.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# angular-input-date 1.0.4\n\nThis module provides a very simple directive to enable support for `input[type=\"date\"]` with the latest stable version of AngularJS (`~1.2.26`).\n\nWith this, you can implement a simple HTML5 standard datepicker for AngularJS.\n\nLook at the [Demo][demo].\n\n*The latest stable version of AngularJS (`~1.2.26`) has no support for `input[type=\"date\"]`.\nThe support was added only for `1.3` branch of Angular, which is now in beta.*\n\n## Installation\n\n### Install library with bower\n\n`bower install --save angular-input-date`\n\n### Add library to your page\n\n``` html\n\u003cscript type=\"text/javascript\" src=\"angular-input-date/src/angular-input-date.js\"\u003e\u003c/script\u003e\n```\n\n### Add dependency in your application's module definition\n\n``` javascript\nvar application = angular.module('application', [\n    // ...\n    'ngInputDate'\n]);\n```\n\n## Usage\n\nJust include the following HTML snippet to your page:\n\n``` html\n\u003cinput type=\"date\" ng-model=\"myDateObject\"\u003e\n```\n\nYou can specify scope value in your controller like this:\n\n``` javascript\napplication.controller('AppCtrl', function($scope) {\n    $scope.myDateObject = new Date(2014, 3, 19);\n});\n```\n\nYour date variable must be a proper [`Date`][mdn-date] object.\nRead section *Detecting value changes* for more details on `Date` object requirements.\n\nHere's the [Demo Example][demo] of how you can use this.\n\n## Notes\n\n### Detecting value changes\n\nThere are situations when you want to compare initial (master) value of the input\nwith the value provided by the user. In order for this to work correctly, you have\nto provide initial `Date` object without a time part. We will call such dates *timeless*.\n\nThe thing is, that `input[type=\"date\"]` HTML element is not designed to contain time information,\nonly a date. So when we pass your `Date` object to it, we have to truncate the time part.\nAnd when a value is read from the input, the time part is already gone, so when you will try\nto compare it against initial `Date` object, you will get a negative result.\n\nYou can create a timeless `Date` object the following way from scratch:\n``` javascript\nvar year = 2014, month = 5, day = 25;\nvar dateWithoutTime = new Date(year, (month - 1), day);\n```\n\nOr if you want to convert existing `Date` object to timeless one, we provide a special\nfunction to do so. Consider the following example:\n\n``` javascript\napplication.controller('AppCtrl', function($scope, someExistingDate, inputDate) {\n    $scope.entity = {\n        date: inputDate.ExtractDate(someExistingDate)\n    };\n});\n```\n\nYou have to inject our service called `inputDate` and invoke it's `ExtractDate` method.\nIt will return proper timeless `Date` object.\n\n## Feedback\n\nIf you have found a bug - please create an issue in this GitHub repository.\n\nIf you have a question - file it with [StackOverflow][so-ask] and send me a\nlink to [s.fomin@betsol.ru][email].\n\nHave any ideas or propositions? Feel free to contact me by the same [E-Mail address][email].\n\nCheers!\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Slava Fomin II\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n[mdn-date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date\n[demo]: http://jsfiddle.net/slavafomin/F2LcY/4/\n[so-ask]: http://stackoverflow.com/questions/ask?tags=angularjs,javascript\n[email]: mailto:s.fomin@betsol.ru","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetsol%2Fangular-input-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetsol%2Fangular-input-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetsol%2Fangular-input-date/lists"}