{"id":26418611,"url":"https://github.com/yegorov/mongoid-day_time","last_synced_at":"2026-04-30T12:33:17.092Z","repository":{"id":56884342,"uuid":"169985527","full_name":"Yegorov/mongoid-day_time","owner":"Yegorov","description":"Mongoid DayTime type","archived":false,"fork":false,"pushed_at":"2019-02-10T14:32:10.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T13:17:05.631Z","etag":null,"topics":["mongodb","mongoid","orm-extension","rails","ruby","time","time-of-day","type"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/Yegorov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-10T14:15:17.000Z","updated_at":"2019-02-10T14:32:11.000Z","dependencies_parsed_at":"2022-08-20T22:31:02.762Z","dependency_job_id":null,"html_url":"https://github.com/Yegorov/mongoid-day_time","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yegorov%2Fmongoid-day_time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yegorov%2Fmongoid-day_time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yegorov%2Fmongoid-day_time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yegorov%2Fmongoid-day_time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yegorov","download_url":"https://codeload.github.com/Yegorov/mongoid-day_time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244141576,"owners_count":20404835,"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":["mongodb","mongoid","orm-extension","rails","ruby","time","time-of-day","type"],"created_at":"2025-03-18T01:48:48.830Z","updated_at":"2025-11-08T01:05:50.855Z","avatar_url":"https://github.com/Yegorov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/Yegorov/mongoid-day_time.svg?branch=master)](https://travis-ci.org/Yegorov/mongoid-day_time)\n[![Gem Version](https://badge.fury.io/rb/mongoid-day_time.svg)](https://badge.fury.io/rb/mongoid-day_time)\n\n# Mongoid DayTime type\n\nSave time in minutes from midnight and show as 24-format string in `HH:MM`\n\nInspired by their issues:\n\n* [MongoDb opening hours Schema and query for open/closed](https://stackoverflow.com/questions/17460235/mongodb-opening-hours-schema-and-query-for-open-closed)\n* [Schema for opening hours MongoDB](https://stackoverflow.com/questions/8375799/schema-for-opening-hours-mongodb)\n* [Best way to store only 'time' in MongoDB?](https://groups.google.com/forum/#!topic/mongodb-user/ki7W4MHhXtg)\n* [How to order data by ONLY Hour:Minute format in MongoDB/Mongoid? (Without date!)\nAsk Question](https://stackoverflow.com/questions/14100782/how-to-order-data-by-only-hourminute-format-in-mongodb-mongoid-without-date)\n\nSome usefull [link](https://docs.mongodb.com/mongoid/current/tutorials/mongoid-documents/#custom-fields)\nfor create custom type for Mongoid.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'mongoid-day_time'\n```\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\n```ruby\n# in your app/models/my_awesome_model.rb\nclass MyAwesomeModel\n  include Mongoid::Document\n\n  field :name, type: String\n  field :time, type: Mongoid::DayTime::Type, default: \"9:35\"\n\nend\n```\n\n```\n# in irb:\n2.6.0 :01 \u003e MyAwesomeModel.create(name: \"foobar\", time: \"10:15\")\n =\u003e #\u003cMyAwesomeModel _id: 5c601a38f047055bcd9f2888, name: \"foobar\", time: 615\u003e\n2.6.0 :02 \u003e m = MyAwesomeModel.last\n =\u003e #\u003cMyAwesomeModel _id: 5c601a38f047055bcd9f2888, name: \"foobar\", time: 615\u003e\n2.6.0 :03 \u003e m.read_attribute_before_type_cast :time\n =\u003e 615\n2.6.0 :04 \u003e m.time\n =\u003e \"10:15\"\n```\n\n## Gotchas :smirk:\n\nDayTime type has not validation, you can type `10:75` and this respresents as\n`10 * 60 + 75` = `675 minutes` what corresponds `11:15`\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` or `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\n[github.com/Yegorov/mongoid-day_time](https://github.com/Yegorov/mongoid-day_time).\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegorov%2Fmongoid-day_time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyegorov%2Fmongoid-day_time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegorov%2Fmongoid-day_time/lists"}