{"id":18185070,"url":"https://github.com/jaandrle/dollar_time","last_synced_at":"2025-04-07T12:40:24.276Z","repository":{"id":47995327,"uuid":"195768638","full_name":"jaandrle/dollar_time","owner":"jaandrle","description":"Utilites for working with JavaScript dates and time in functional way. Uses native Date class. Subrepository for https://github.com/jaandrle/jaaJSU ($time namespace) ","archived":false,"fork":false,"pushed_at":"2022-12-04T02:05:15.000Z","size":779,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T18:13:19.682Z","etag":null,"topics":["date","dates","functional","javascript","time"],"latest_commit_sha":null,"homepage":"","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/jaandrle.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-07-08T08:24:57.000Z","updated_at":"2022-08-11T13:22:37.000Z","dependencies_parsed_at":"2023-01-23T23:15:13.024Z","dependency_job_id":null,"html_url":"https://github.com/jaandrle/dollar_time","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/jaandrle%2Fdollar_time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdollar_time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdollar_time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaandrle%2Fdollar_time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaandrle","download_url":"https://codeload.github.com/jaandrle/dollar_time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247654965,"owners_count":20974101,"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","dates","functional","javascript","time"],"created_at":"2024-11-02T22:05:52.704Z","updated_at":"2025-04-07T12:40:24.252Z","avatar_url":"https://github.com/jaandrle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jaaJSU \u003e $time ( jaandrle \u003e JavaScript Utils \u003e $time namespace )\n\nSubrepository for [jaandrle/jaaJSU ($time namespace)](https://github.com/jaandrle/jaaJSU).\n\nNamespace `$time` contains utilites for working with JavaScript dates in *functional way*. There are *$time.from*★\nfunctions which create array in form of `[ date, time, zone ]` (e.g. `[ \"2019-02-06\", \"T12:00:00\", \"Z\" ]`) … so\n*.join(\"\")* is valid argument for **Date** class. When it is combined with `$function.sequention` (from **jaaJSU**,\nor similar *pipe* function for exmple [Ramda `R.pipe`](https://ramdajs.com/docs/#pipe)) it is possible to write:\n\n```JavaScript\n/* manipulations */\n$function.sequention( $time.fromString, $time.modify({ addDays: -6 }), $time.toString(\"YYYY-MM-DD\") )(\"2019-07-01\");\n//= \"2019-06-25\"\n```\n\nLibrary also supports localization - internaly uses [`Date.prototype.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString).\n\n**IMPORTANT NOTE 1:** This is primary for my (company) internal purpose, but it can be helpful for others at least for\ninspiration. One of the reason was to replace [Moment.js ](https://momentjs.com/) so some parts are inspired with this\nlibrary.\n\n**IMPORTANT NOTE 2:** There isn't strict development cycle for now + WIP!!!\n\n**IMPORTANT NOTE 3:** Supports all modern browsers — main limitations are new patterns (e.g. arrow functions) and\n[`Date.prototype.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\\_Objects/Date/toLocaleString) see [compatibility table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\\_Objects/Date/toLocaleString#Browser\\_compatibility) (iOS webkit in Cordova works - based on my tests, but I haven't found any official report about it)\n\n## Links\n\n- **WIP !!!** [Documentation](docs/modules/\\_time.md)\n\n## Contribute\n\n- Installation: use `node install`\n- Build: use `gulp`\n- Build parameters can be changed in: `package.json`\n\n## Quick examples\n\n```JavaScript\n/* just helper */const $function= { sequention: function(...functions){return function(input){let current= input; for(let i=0, i_length= functions.length; i\u003ci_length; i++){ current= functions[i](current); } return current; }; } };\n\n/* get week number */\n$function.sequention( $time.fromString, $time.toString(\"W\") )(\"2019-07-01\");\n//= 27\n$function.sequention( $time.fromString, $time.toString(\"Wo\") )(\"2019-07-01\");\n//= 27th\n/* date/time formats */\nconst niceFormat= $function.sequention( $time.fromString, $time.toString(\"dddd[, ]Do MMMM YYYY\") );\nniceFormat(\"2019-07-01\");\n//= \"Monday, 1st July 2019\"\nniceFormat(\"2000-01-01\");\n//= \"Saturday, 1st January 2000\"\n/* relative times */\nconst toRelativeFromStrings= $function.sequention( $time.fromString, $time.toRelative($time.fromString(\"2019-07-10 12:35:15\")) );\ntoRelativeFromStrings(\"2019-07-10 12:35:14\");\n//= \"1 second ago\"\ntoRelativeFromStrings(\"2019-07-10 12:34:30\");\n//= \"45 seconds ago\"\ntoRelativeFromStrings(\"2018-07-01 09:32:15\");\n//= \"last year\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaandrle%2Fdollar_time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaandrle%2Fdollar_time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaandrle%2Fdollar_time/lists"}