{"id":13447163,"url":"https://github.com/eddiejibson/dubium","last_synced_at":"2025-03-21T02:31:28.632Z","repository":{"id":34410178,"uuid":"178694584","full_name":"eddiejibson/dubium","owner":"eddiejibson","description":"Light Javascript date and time utilities (formatting, ranges e.t.c)","archived":false,"fork":false,"pushed_at":"2023-01-03T18:51:46.000Z","size":895,"stargazers_count":18,"open_issues_count":13,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:52:18.990Z","etag":null,"topics":["date","date-time","dubium","formatting","javascript","moment","node","nodejs","ranges","time"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/eddiejibson.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}},"created_at":"2019-03-31T13:52:19.000Z","updated_at":"2021-01-18T22:35:45.000Z","dependencies_parsed_at":"2023-01-15T06:55:38.928Z","dependency_job_id":null,"html_url":"https://github.com/eddiejibson/dubium","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddiejibson%2Fdubium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddiejibson%2Fdubium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddiejibson%2Fdubium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddiejibson%2Fdubium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddiejibson","download_url":"https://codeload.github.com/eddiejibson/dubium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244725553,"owners_count":20499628,"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":["date","date-time","dubium","formatting","javascript","moment","node","nodejs","ranges","time"],"created_at":"2024-07-31T05:01:09.851Z","updated_at":"2025-03-21T02:31:28.243Z","avatar_url":"https://github.com/eddiejibson.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"logo.png\"\u003e\n    \u003cbr\u003e\n    \u003cp\u003e\u003ci\u003eLight (1kb gzipped) Javascript date and time utilities (formatting, ranges e.t.c).\u003c/i\u003e\u003c/p\u003e\n\u003c/div\u003e\n\nIf you appreciate this project, please 🌟 it on [GitHub](https://github.com/eddiejibson/dubium).\n\nDubium works both in the browser and with node.\n\nFor browser use, either host the dubium.js file yourself (By [downloading the current release here](https://github.com/eddiejibson/dubium/releases)) or use a CDN (and, yes, it's free):\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/dubium@0.0.14/dist/dubium.min.js\"\u003e\u003c/script\u003e\n```\n\nAs for NodeJS, it can be included like so:\n\n```javascript\nconst dubium = require(\"dubium\");\n```\n\n## Example\n\n\n```javascript\n// In this example, if the date is not passed in, we'll pretend it's currently\n// Febuary 1, 1970 19:30:00 UTC.\n\n// .format returns the current date and/or time in a formatted manor\ndubium.format(\"DD/MM/YYYY hh:mm:ss\") // 01/02/1970 19:30:00\ndubium.format(\"MM/DD/YYYY H:mm:ss a\") // 02/01/1970 7:30:00 pm\ndubium.format(\"DD/MMM/YY H:mm:ss A\") // 01/Mar/70 7:30:00 PM\ndubium.format(\"DD/MMMM/YY H:mm:ss A\") // 01/March/70 7:30:00 PM\n\n// You can also pass in a date to format:\ndubium.format(\"DD/MM/YYYY hh:mm:ss\", 1554159037369); // 01/04/2019 23:50:37\ndubium.format(\"DD/MM/YYYY hh:mm:ss\", \"Fri, 02 Feb 1996 03:04:05 GMT\"); // 02/02/1996 03:04:05\n\n// You may unformat a string to get the epoch integer:\ndubium.unformat(\"01/March/70 7:30:00 PM\", \"DD/MMMM/YY H:mm:ss A\"); // 3163604400000\n\n// You can get all the day value from a range of dates (inclusive of the ones being passed in)...\ndubium.daysInRange(1554160761053, 1554333561053) // Array(3) [ 1554160761053, 1554247161053, 1554333561053 ]\n\n// You can also get the range of the start of the week and end\ndubium.getWeekRange() //Array [ 1554073200000, 1554677999999 ]\n// Obviously you can pass an epoch value, too, if you want:\ndubium.getWeekRange(3163604400000); // Array [ 3163446000000, 3161375999999 ]\n\n// And, yeah, that's pretty much it... \n// These functions will be improved and added upon soon, too.\n```\n\n## Benchmarks\n\nTested the speed of formatting and unformatting in Chrome 75 on Windows 10.\n\nSee it for yourself [here on jsPerf](https://jsperf.com/dubium/4).\n\n|Library|Ops/sec|\n|--|--|\n|Dubium|197,278|\n|[DayJS](https://github.com/iamkun/dayjs)|108,859|\n|[MomentJS](https://github.com/moment/moment)|56,163|\n\n\n## Development\n\nBuilding dubium for browser:\n\n```bash\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddiejibson%2Fdubium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddiejibson%2Fdubium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddiejibson%2Fdubium/lists"}