{"id":13515539,"url":"https://github.com/urin/qrono","last_synced_at":"2026-03-07T17:01:06.934Z","repository":{"id":46208291,"uuid":"420366076","full_name":"urin/qrono","owner":"urin","description":"🕥 4kB JavaScript date library with 100+ APIs and strict DST guarantees. Designed for single-timezone applications.","archived":false,"fork":false,"pushed_at":"2026-02-22T14:03:47.000Z","size":551,"stargazers_count":128,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-22T17:20:46.846Z","etag":null,"topics":["date","datetime","javascript","javascript-library","qrono","time"],"latest_commit_sha":null,"homepage":"https://qronojs.dev/","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/urin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"urin"}},"created_at":"2021-10-23T09:14:47.000Z","updated_at":"2026-02-22T14:03:42.000Z","dependencies_parsed_at":"2026-02-07T09:09:00.350Z","dependency_job_id":null,"html_url":"https://github.com/urin/qrono","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.038461538461538436","last_synced_commit":"a6e86e89bd4f0b203386859ab92c5cb4ed0821c1"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/urin/qrono","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urin%2Fqrono","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urin%2Fqrono/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urin%2Fqrono/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urin%2Fqrono/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/urin","download_url":"https://codeload.github.com/urin/qrono/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urin%2Fqrono/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30222338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T14:02:48.375Z","status":"ssl_error","status_checked_at":"2026-03-07T14:02:43.192Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","datetime","javascript","javascript-library","qrono","time"],"created_at":"2024-08-01T05:01:12.649Z","updated_at":"2026-03-07T17:01:06.920Z","avatar_url":"https://github.com/urin.png","language":"JavaScript","funding_links":["https://github.com/sponsors/urin"],"categories":["JavaScript","TypeScript"],"sub_categories":[],"readme":"# \u003cimg src=\"docs/public/logo.svg\" alt=\"Qrono Logo\" width=\"48\"\u003e [Qrono](https://qronojs.dev/) — Small. Complete. Deterministic. JavaScript date-time.\n\n_**4kB** JavaScript date library with **100+ APIs** and **strict DST guarantees**. Designed for **single-timezone** applications._\n\n[![MIT License][image-license]][url-license]\n[![CodeQL][image-codeql]][url-codeql]\n[![NPM version][image-npm-version]][url-npm]\n[![NPM downloads][image-downloads]][url-downloads]\n[![gzip size][image-size]][url-size]\n\n```js\nimport { qrono } from 'qrono'\n\n// UTC-first\nconst now = qrono().toString() // '2027-01-23T12:34:56:789Z'\n// DST overlap (occurs twice) of Europe/London\nqrono.context({ localtime: true })\nconst t = '2019-10-27T01:30:00'\nqrono(t) // 01:30 +00:00 Same as JavaScript's `Date`\nqrono({ disambiguation: 'earlier' }, t) // 01:30 +00:00\nqrono({ disambiguation: 'later' }, t)   // 01:30 +01:00\nqrono({ disambiguation: 'reject' }, t)  // throws RangeError\n\nnow.plus(0, 1, 10) // +1 month, +10 days\nnow.startOfMonth()\nnow.isBetween(qrono('2024-01-01'), qrono('2024-12-31'))\nconst date = qrono.date('2024-06-15')\ndate.dayOfYear()   // 167\ndate.weekOfYear()  // 24\ndate.endOfMonth()  // 2024-06-30\n```\n\n[🌐 Website\u003csup\u003e ↗\u003c/sup\u003e](https://qronojs.dev/) \\| [🎨 Design philosophy](#design-philosophy-) \\| [📥 Getting started](#getting-started-) \\| [🚀 Quick tour](#quick-tour-) \\| [🌏 License](#license-)\n\n---\n\n## Design Philosophy 🎨\n\n#### 🔐 **Immutable, Intuitive and Chainable**\n- All operations return new instances for safe, predictable data and intuitive API.\n- Covers the majority of common use cases.\n\n#### 🔷 **TypeScript Ready**\n- Full TypeScript definitions included for type-safe development.\n- Designed to work seamlessly in both server-side and browser-side JavaScript environments.\n\n#### ⚡ **Minimal and Focused**\n- Pure JavaScript with zero dependencies.\n- Lightweight (**4kB**) with **100+** APIs through focused design.\n\n#### 🌍 **UTC-first with Local Time Support**\n- Supports UTC by default and the environment's local time zone.\n- Locale-agnostic design delegates localization to the [ECMAScript Internationalization API](https://402.ecma-international.org/#overview).\n\n#### 🕐 **Strict DST Handling**\n- Unique DST-aware APIs that no other library provides.\n- Explicit handling of ambiguous daylight saving time transitions through dedicated APIs.\n\n#### ✅ **ISO 8601 Compliant**\n- Fully compliant with the [ISO 8601](https://www.iso.org/obp/ui/#iso:std:iso:8601:-1:ed-1:v1:en) standard for reliable date-time exchange and interoperability.\n\n### Alternatives\n\n- **[Moment.js](https://momentjs.com/)**  \n  A widely used library that was once the de facto standard for date-time handling in JavaScript. It entered maintenance mode in 2020.  \n  Its mutable API design can lead to unintended side effects and bugs. Most modern date-time libraries introduced below are designed to be immutable.\n\n- **[Luxon](https://moment.github.io/luxon/)**  \n  An immutable, feature-rich library created by the maintainers of Moment.js. It provides comprehensive timezone and formatting support.  \n  By default, it operates in the system’s local time zone and does not provide strict disambiguation for ambiguous local times.  \n  Its documentation clearly explains how ambiguous times are handled.\n\n- **[Day.js](https://day.js.org/)**  \n  A small, Moment.js-compatible library with a large GitHub following, increasingly considered a de facto standard.  \n  Approximately 3kB with 30+ core APIs. Timezone, locale support, and additional functionality require plugins.  \n  Currently preparing a major version upgrade.\n\n- **[date-fns](https://date-fns.org/)**  \n  Provides 200+ pure functions for manipulating JavaScript `Date` objects. Implemented in TypeScript and fully tree-shakeable.  \n  Because it builds directly on the native `Date` object, it inherits limitations such as mutability and zero-based months.\n\nNone of these libraries provide dedicated APIs for strict DST transition handling.  \nQrono addresses this gap with a balanced and pragmatic approach.\n\n- **[The ECMA TC39 Temporal Proposal](https://tc39.es/proposal-temporal/docs/index.html)**  \n  A proposed ECMAScript API that may become a future standard. Temporal (TC39) defines a comprehensive and rigorous date-time model, including numerous classes such as `Instant`, `Duration`, and `ZonedDateTime`, and provides a complete API covering locale handling and the IANA time zone database. While this design ensures correctness and precision across a wide range of use cases, its breadth and strictness can make it heavyweight and difficult to grasp for developers who simply need to handle date and time operations.\n\nIn contrast, Qrono focuses on delivering the simplest possible API surface while remaining practical for real-world applications, prioritizing clarity and usability over exhaustive completeness.\n\n### Repository Size Comparison\n\n[![Comparison of repository size](docs/public/comparison-repo-size.svg)](docs/public/comparison-repo-size.svg)\n\nThis comparison shows that **Qrono stands out for its small codebase** among other libraries. Its compact size reflects a strong focus on minimalism and efficiency, making it well suited for situations where bundle size and simplicity are important.\n\nFor many of the other libraries, their larger size is due to the fact that a significant portion of the codebase is dedicated to supporting a wide range of locales. Meanwhile, the larger size of date-fns is intentional and not a drawback. It is designed with tree-shaking in mind, so unused functions are removed at build time, and its API is intentionally fine-grained and verbose to provide clarity and flexibility. The size difference therefore represents a difference in design philosophy, not a measure of overall quality.\n\n### Supporting Only the Local Time of the Execution Environment\n\nWhen handling time in a globally accessible web application, careful consideration is required for local time.\n\nIn general, the server does not know the user’s actual time zone or the time zone of the client environment (OS).\nIf the system needs to be aware of the user’s time zone, an application-level mechanism to manage time zones becomes necessary. In practice, however, the user’s time zone is usually assumed to be the same as the client environment’s (OS) time zone.\n\nFor example, a user who resides in Japan may start using the application in the United States. If the user changes the OS time zone to match the local time in the United States, this will be done automatically in most cases, such as when the environment is a smart device; the client environment's time zone will differ from the one that is managed in the server. Considering the large number of such edge cases, it is impractical for a server-side application to manage each user's intended time zone in a database-like manner.\n\nFor this reason, to keep the system design simple, the server should avoid managing user-specific time zones. Instead, the server should store and handle time exclusively in UTC. All time values should be transmitted to clients in UTC (typically as ISO 8601–formatted strings), and converting them into local time should be the responsibility of the client.\n\nEven when support for multiple locales is required, storing time data in UTC is usually sufficient. In most cases, locale-specific formatting can be handled entirely on the client side by using the [ECMAScript Internationalization API](https://402.ecma-international.org/#overview).\n\nOne important caveat of this design is that the time zone database of the client environment (OS) must be properly maintained. Daylight saving time rules — for example, in Brazil — may change from year to year, and time zone definitions themselves are determined by laws that are frequently revised. This means that the underlying time zone database must be kept up to date.\n\nIf the application is used in a closed or unmanaged environment where such updates cannot be applied due to special constraints, the approach described above may be insufficient.\n\nIn most typical environments, this requirement is satisfied automatically through the operating system’s regular update mechanisms, so it does not pose a practical issue for the majority of applications. However, if the application is used in a closed or unmanaged environment where such updates cannot be applied due to special constraints, the approach described above may be insufficient.\n\nConsidering these factors, **Qrono** is deliberately designed to forgo support for multiple time zones in order to achieve greater overall benefits, such as a **small code base and easy handling of daylight saving time transitions**.\n\n### About Daylight Saving Time\n\nQrono is the only JavaScript date-time library with dedicated APIs for DST handling (`hasOffsetChangeInYear()`, `isInDst()`, `hasOffsetChangeInDay()`, `minutesInDay()`).\n\nJavaScript's `Date` object can behave in non-intuitive ways when handling daylight saving time transitions.\n\nFor example, see the following scenario in the Central Standard Time (CST) zone of the USA:\n\n```javascript\nconst date = new Date('2021-03-14T03:00:00.000')\ndate.setMilliseconds(-1) // results 2021-03-14 03:59:59.999 CST\n```\n\nOn March 14, 2021, daylight saving time begins. The time jumps directly from `2021-03-14 01:59:59 CST` to `2021-03-14 03:00:00 CST`.\n\nIn this example, subtracting 1 millisecond from `2021-03-14 03:00:00.000 CST` results in `2021-03-14 03:59:59.999 CST`. This appears to be a simple subtraction of 1 millisecond, but it actually advances the time by 1 hour.\n\nThis behavior is not a bug but a result of strictly following the [ECMAScript specification](https://262.ecma-international.org/11.0/#sec-local-time-zone-adjustment).\n\nAdditionally, a `Date` object created from a duplicated time during daylight saving time (DST) transition always refers to the time before DST ends. In other words, there is no simple way to obtain a `Date` object that refers to the UTC time **after** the end of DST from a duplicated time.\n\n**Qrono** addresses these issues by providing a more understandable approach to handling such transitions.\n\n## Getting started 📥\n\n```sh\nnpm  install qrono        # for npm\ndeno add jsr:@urin/qrono  # for Deno\nbunx jsr add @urin/qrono  # for Bun\npnpm add     @urin/qrono  # for pnpm\nyarn add     @urin/qrono  # for Yarn\n```\n\n```html\n\u003c!-- for Browser --\u003e\n\u003cscript src=\"path/to/qrono.min.js\"\u003e\u003c/script\u003e\n\u003c!-- from UNPKG --\u003e\n\u003cscript src=\"https://unpkg.com/qrono/dist/qrono.min.js\"\u003e\u003c/script\u003e\n```\n\n```js\n// as module\nimport { qrono } from 'qrono'\n// or CommonJS\nconst { qrono } = require('qrono')\n```\n\n## Quick tour 🚀\n\nVisit [official website\u003csup\u003e ↗\u003c/sup\u003e](https://qronojs.dev/) for complete documentation.\n\n- Factory\n  - [qrono(...args)](https://qronojs.dev/api/#qrono) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e14 overloads\u003c/sup\u003e\n  - [qrono.date(...args)](https://qronojs.dev/api/#qrono-date) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e7 overloads\u003c/sup\u003e\n- Conversion\n  - [.toString()](https://qronojs.dev/api/#tostring) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.valueOf()](https://qronojs.dev/api/#valueof) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.toArray()](https://qronojs.dev/api/#toarray) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.toObject()](https://qronojs.dev/api/#toobject) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.nativeDate()](https://qronojs.dev/api/#nativedate) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.toDate()](https://qronojs.dev/api/#todate) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.toDatetime()](https://qronojs.dev/api/#todatetime) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n- Constants\n  - [qrono.monday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [qrono.tuesday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [qrono.wednesday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [qrono.thursday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [qrono.friday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [qrono.saturday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [qrono.sunday](https://qronojs.dev/api/#day-constants) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e\n- Accessors\n  - [.year()](https://qronojs.dev/api/#year) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.month()](https://qronojs.dev/api/#month) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.day()](https://qronojs.dev/api/#day) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.hour()](https://qronojs.dev/api/#hour) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.minute()](https://qronojs.dev/api/#minute) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.second()](https://qronojs.dev/api/#second) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.millisecond()](https://qronojs.dev/api/#millisecond) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.offset()](https://qronojs.dev/api/#offset) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e\n- Context\n  - [qrono.context()](https://qronojs.dev/api/#default-context) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/static-lightsteelblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n  - [.context()](https://qronojs.dev/api/#context) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e2 overloads\u003c/sup\u003e\n- Calculation\n  - [.plus(duration)](https://qronojs.dev/api/#plus) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e4 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e4 overloads\u003c/sup\u003e\n  - [.minus(duration)](https://qronojs.dev/api/#minus) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e4 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e4 overloads\u003c/sup\u003e\n  - [.valid()](https://qronojs.dev/api/#valid) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n- Comparison\n  - [.isSame(other)](https://qronojs.dev/api/#issame) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e\n  - [.isBefore(other)](https://qronojs.dev/api/#isbefore) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e\n  - [.isAfter(other)](https://qronojs.dev/api/#isafter) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e\n  - [.isSameOrBefore(other)](https://qronojs.dev/api/#issameorbefore) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e\n  - [.isSameOrAfter(other)](https://qronojs.dev/api/#issameorafter) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e\n  - [.isBetween(start, end)](https://qronojs.dev/api/#isbetween) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e \u003csup\u003e3 overloads\u003c/sup\u003e\n- Time Unit Boundary\n  - [.startOfYear()](https://qronojs.dev/api/#startofyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.startOfMonth()](https://qronojs.dev/api/#startofmonth) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.startOfDay()](https://qronojs.dev/api/#startofday) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.startOfHour()](https://qronojs.dev/api/#startofhour) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.startOfMinute()](https://qronojs.dev/api/#startofminute) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.startOfSecond()](https://qronojs.dev/api/#startofsecond) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.endOfYear()](https://qronojs.dev/api/#endofyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.endOfMonth()](https://qronojs.dev/api/#endofmonth) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n- Date Information\n  - [.dayOfWeek()](https://qronojs.dev/api/#dayofweek) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.dayOfYear()](https://qronojs.dev/api/#dayofyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.weekOfYear()](https://qronojs.dev/api/#weekofyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.yearOfWeek()](https://qronojs.dev/api/#yearofweek) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.isLeapYear()](https://qronojs.dev/api/#isleapyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.daysInMonth()](https://qronojs.dev/api/#daysinmonth) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.daysInYear()](https://qronojs.dev/api/#daysinyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.weeksInYear()](https://qronojs.dev/api/#weeksinyear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n- Daylight Saving Time\n  - [.hasOffsetChangeInYear()](https://qronojs.dev/api/#hasOffsetChangeInYear) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.isInDst()](https://qronojs.dev/api/#isindst) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.hasOffsetChangeInDay()](https://qronojs.dev/api/#hasOffsetChangeInDay) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n  - [.minutesInDay()](https://qronojs.dev/api/#minutesinday) \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/Qrono-cornflowerblue\" height=\"14\"\u003e\u003c/sub\u003e \u003csub\u003e\u003cimg src=\"https://img.shields.io/badge/QronoDate-darkseagreen\" height=\"14\"\u003e\u003c/sub\u003e\n\n### Construction\n\n```js\n// now\nqrono()\n// from various types of arguments\nqrono('2022-12-31') // =\u003e 2022-12-31T00:00:00.000Z\nqrono(new Date())\n// the following are the same 2022-12-31T15:23:11.321Z\nqrono('2022-12-31 15:23:11.321')\nqrono(1672500191321)\nqrono(2022, 12, 31, 15, 23, 11, 321)\nqrono([2022, 12, 31, 15, 23, 11, 321])\nqrono({ year: 2022, month: 12, day: 31, hour: 15, minute: 23, second: 11, millisecond: 321 })\n```\n\n### Accessor\n\n```js\nconst time = qrono(2022, 12, 31, 15, 23, 11, 321)\ntime.year()        // =\u003e 2022\ntime.month()       // =\u003e 12\ntime.day()         // =\u003e 31\ntime.hour()        // =\u003e 15\ntime.minute()      // =\u003e 23\ntime.second()      // =\u003e 11\ntime.millisecond() // =\u003e 321\n\ntime.second(0) // =\u003e returns new Qrono instance\n```\n\n### Time zone\n\n```js\n// UTC as default\nqrono('2022-12-31 15:23:11.321').toString() // =\u003e \"2022-12-31T15:23:11.321Z\"\n// set default to local time\nqrono.context({ localtime: true })\nqrono('2022-12-31 15:23:11.321').toString()     // =\u003e \"2022-12-31T15:23:11.321-04:00\"\nqrono('2022-12-31 15:23:11.321').context({ localtime: false }).hour() // =\u003e 11 as UTC\nqrono('2022-12-31 15:23:11.321').hour()         // =\u003e 15 as local time\n```\n\n### Conversion\n\n```js\n+qrono('2000-01-01')          // =\u003e 946,684,800,000 milliseconds from UNIX epoch\nconst time = qrono('2000-01-02 03:04:05.006')\ntime.toObject()   // =\u003e { year: 2000, month: 1, day: 2, hour: 3, minute: 4, second: 5, millisecond: 6 }\ntime.toArray()    // =\u003e [2000, 1, 2, 3, 4, 5, 6]\ntime.nativeDate() // =\u003e JavaScript native `Date` instance\n```\n\n### Calculation\n\n```js\nqrono('2000-01-01 01:00:00.000') - qrono('2000-01-01') // =\u003e 3,600,000 milliseconds = 1 hour\nqrono('2000-01-01 01:00:00.000') \u003c qrono('2000-01-01') // =\u003e false\nqrono('2000-01-01').plus(7200000).minus(3600000)       // =\u003e 2000-01-01T01:00:00.000Z\n// In operations using Object, `year`, `month`, and `day` are calculated literally.\n// For example, adding one month at the end of a month results in the end of the following month.\n// `hour`, `minute`, `second`, and `millisecond` are treated as a duration in calculations.\nqrono('2000-01-01').minus({ hour: 1, minute: 30 })     // =\u003e 1999-12-31T22:30:00.000Z\nqrono('2020-02-29').plus({ year: 1 })                  // =\u003e 2021-02-28T00:00:00.000Z\nqrono('2021-12-31').minus({ month: 1 })                // =\u003e 2021-11-30T00:00:00.000Z\n\nconst today = qrono()\nconst yesterday = today.minus({ day: 1 })\nconst tomorrow = today.plus({ day: 1 })\ntoday.isBetween(yesterday, tomorrow) // =\u003e true\n```\n\n### Short-hands\n\n```js\nconst time = qrono('2000-01-02 03:04:05.006')\ntime.startOfYear()   // =\u003e 2000-01-01T00:00:00.000Z\ntime.startOfMonth()  // =\u003e 2000-01-01T00:00:00.000Z\ntime.startOfDay()    // =\u003e 2000-01-02T00:00:00.000Z\ntime.startOfHour()   // =\u003e 2000-01-02T03:00:00.000Z\ntime.startOfMinute() // =\u003e 2000-01-02T03:04:00.000Z\ntime.startOfSecond() // =\u003e 2000-01-02T03:04:05.000Z\ntime.dayOfWeek()     // =\u003e 7 === qrono.sunday\ntime.dayOfYear()     // =\u003e 2\ntime.isLeapYear()    // =\u003e true\ntime.daysInMonth()   // =\u003e 31\ntime.daysInYear()    // =\u003e 366\n// ISO week number. See https://en.wikipedia.org/wiki/ISO_week_date\ntime.weeksInYear()   // =\u003e 52\ntime.weekOfYear()    // =\u003e 52\ntime.yearOfWeek()    // =\u003e 1999\n// Daylight saving time stuff that is meaningful in case of local time\nconst localtime = time.context({ localtime: true })\nlocaltime.hasOffsetChangeInYear()\nlocaltime.isInDst()\nlocaltime.hasOffsetChangeInDay()\nlocaltime.minutesInDay()\n```\n\n### QronoDate\n\n`qrono.date(...)` returns a `QronoDate` instance with only date information.\n\nMethods of `QronoDate` are almost compatible with those of `Qrono`.\n\n```js\nqrono.date('2000-01-02').toString()       // =\u003e \"2000-01-02\"\nqrono('2000-01-02 23:04:05.006').toDate() // =\u003e QronoDate instance 2000-01-02\n+qrono.date('2000-01-02')                 // =\u003e 10958 days from UNIX epoch\n```\n\n## License 🌏\n\n[MIT][url-license]\n\nCopyright (c) 2021 [Urin](https://github.com/urin)\n\n\n\u003c!-- Reference --\u003e\n[image-codeql]: https://github.com/urin/qrono/actions/workflows/github-code-scanning/codeql/badge.svg\n[url-codeql]: https://github.com/urin/qrono/actions/workflows/github-code-scanning/codeql\n\n[image-license]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n[url-license]: LICENSE\n\n[image-npm-version]: https://img.shields.io/npm/v/qrono.svg?style=flat\n[url-npm]: https://npmjs.org/package/qrono\n\n[image-downloads]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/urin/my-actions/main/badges/downloads.json\n[url-downloads]: https://npmcharts.com/compare/qrono?minimal=true\n\n[image-size]: https://img.badgesize.io/https://unpkg.com/qrono/dist/qrono.min.js?compression=gzip\u0026color=blue\n[url-size]: https://unpkg.com/qrono/dist/qrono.min.js\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furin%2Fqrono","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furin%2Fqrono","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furin%2Fqrono/lists"}