{"id":15573199,"url":"https://github.com/polo2ro/jurassic","last_synced_at":"2025-03-29T06:43:50.196Z","repository":{"id":26807393,"uuid":"30265886","full_name":"polo2ro/jurassic","owner":"polo2ro","description":"A javascript library for periods manipulations","archived":false,"fork":false,"pushed_at":"2019-04-14T12:01:50.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T19:18:18.931Z","etag":null,"topics":["javascript","javascript-library","operations","period","periods-manipulations","subtraction"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/polo2ro.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-02-03T21:38:04.000Z","updated_at":"2019-04-14T12:01:20.000Z","dependencies_parsed_at":"2022-09-20T04:13:08.106Z","dependency_job_id":null,"html_url":"https://github.com/polo2ro/jurassic","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/polo2ro%2Fjurassic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polo2ro%2Fjurassic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polo2ro%2Fjurassic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polo2ro%2Fjurassic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polo2ro","download_url":"https://codeload.github.com/polo2ro/jurassic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246150415,"owners_count":20731419,"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":["javascript","javascript-library","operations","period","periods-manipulations","subtraction"],"created_at":"2024-10-02T18:11:16.318Z","updated_at":"2025-03-29T06:43:50.153Z","avatar_url":"https://github.com/polo2ro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/polo2ro/jurassic.svg?branch=master)](https://travis-ci.org/polo2ro/jurassic)\n\n# jurassic\n\nA javascript library for periods manipulations. \n\nThe library contain 2 base objects to handle periods:\n\n* jurassic.Era: a group of periods\n* jurassic.Period: a period with a start date and end date\n\nThe library has been tested only on node.js\n\nUsage\n-----\n\n```bash\nnpm install jurassic\n```\n\n\n# Methods\n\nEra.addPeriod\n-------------\nAdd a period to Era, accept a period object as parameter, \nif the given parameter is not a period, the period will be created from the object\n\n```javascript\n\nvar jurassic = require('jurassic');\nvar era = new jurassic.Era();\n\nvar event1 = new jurassic.Period();\nevent1.dtstart = new Date(2014,0,1);\nevent1.dtend = new Date(2014,0,3);\n\nera.addPeriod(event1);\n\nera.addPeriod({\n    dtstart: new Date(2014,0,6),\n    dtend: new Date(2014,0,8)\n});\n```\n\nThe period can contain other properties such as icalendar properties\n\n\nEra.removePeriod\n----------------\nRemove a periods from era using dates only, if a period with the same dates exists in era, il will be removed.\nAccept a period object as parameter\n\nEra.getFlattenedEra\n-------------------\nGet a new era with all overlapping periods merged as single periods\n\nEra.addEra\n----------\nReturns a new Era object whose value is the sum of the specified Era object and this instance.\n\nEra.subtractPeriod\n-------------------\nUpdate the Era object with the difference between the specified Period object and this instance.\nAccept a period object as parameter\n\n\n```javascript\n\nvar jurassic = require('jurassic');\nvar era = new jurassic.Era();\n\nera.addPeriod({\n    dtstart: new Date(2014,0,1),\n    dtend: new Date(2014,0,15)\n});\n\nvar drill = new jurassic.Period();\ndrill.dtstart = new Date(2014,0,10);\ndrill.dtend = new Date(2014,0,11);\n\nera.subtractPeriod(drill);\n\n// here we have 2 periods, from 1 to 10 and from 11 to 15\n```\n\n\n\nEra.subtractEra\n----------------\nUpdate the Era object with the difference between the specified Era object and this instance.\n\n\n\nEra.intersectPeriod\n-------------------\nGet the intesection of the era with a period. Accept a period object as parameter. This method return an Era object (a list of periods)\nthe properties from the periods stored in the era object will be retained in the new periods produced by this method.\n\nEra.intersectEra\n----------------\nGet the intesection of the specified Era object and this instance. This method return an Era object (a list of periods)\n\n\n\n# Period\n\nA period can contain any property, only dtstart and dtend are mandatory for the interaction with the library methods.\n\n\nPeriod.getBusinessDays\n--------------\nget the number of days in period with a precision of 0.5 days\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolo2ro%2Fjurassic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolo2ro%2Fjurassic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolo2ro%2Fjurassic/lists"}