{"id":13808308,"url":"https://github.com/dstelljes/luxon-angular","last_synced_at":"2025-05-14T02:31:47.624Z","repository":{"id":26310856,"uuid":"106893028","full_name":"dstelljes/luxon-angular","owner":"dstelljes","description":"date pipes for Angular","archived":false,"fork":false,"pushed_at":"2024-04-06T18:48:01.000Z","size":1751,"stargazers_count":26,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T12:07:33.513Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dstelljes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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}},"created_at":"2017-10-14T02:55:58.000Z","updated_at":"2024-05-31T22:41:18.438Z","dependencies_parsed_at":"2023-02-19T14:15:28.526Z","dependency_job_id":"863b1369-0a64-4457-86d5-ce9823fa254d","html_url":"https://github.com/dstelljes/luxon-angular","commit_stats":{"total_commits":103,"total_committers":7,"mean_commits":"14.714285714285714","dds":0.09708737864077666,"last_synced_commit":"5d1311c4db6e502cef4f04284c0192b0138f8e60"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstelljes%2Fluxon-angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstelljes%2Fluxon-angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstelljes%2Fluxon-angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dstelljes%2Fluxon-angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dstelljes","download_url":"https://codeload.github.com/dstelljes/luxon-angular/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225273229,"owners_count":17448072,"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":["hacktoberfest"],"created_at":"2024-08-04T01:01:39.695Z","updated_at":"2024-11-19T00:30:42.277Z","avatar_url":"https://github.com/dstelljes.png","language":"TypeScript","readme":"# luxon-angular\n\nThis is a collection of date/time pipes for Angular (12+) based on [Luxon][luxon].\n\n## Getting started\n\n-   Install (making sure Luxon is installed as well):\n\n    ```\n    npm install --save luxon luxon-angular\n    ```\n\n    or\n\n    ```\n    yarn add luxon luxon-angular\n    ```\n\n    If you plan to use the relative formatting pipes, also install the [`relative-time-format`][relative-time-polyfill] polyfill.\n\n-   Import `LuxonModule`:\n\n    ```typescript\n    import { NgModule } from '@angular/core';\n    import { LuxonModule } from 'luxon-angular';\n\n    @NgModule({\n      imports: [\n        LuxonModule\n      ]\n    })\n    export class AppModule {\n\n    };\n    ```\n\n-   Start using the pipes:\n\n    ```typescript\n    import { Component } from '@angular/core';\n\n    @Component({\n      template: `\n        This component was created at {{ date | dateTimeFromJsDate | dateTimeToFormat:'tt' }}!\n      `\n    })\n    export class AppComponent {\n      date: Date;\n\n      constructor() {\n        this.date = new Date();\n      }\n    };\n    ```\n\n## Available pipes\n\n-   [Parsing](#parsing)\n-   [Math](#math)\n-   [Time zones and offsets](#time-zones-and-offsets)\n-   [Formatting](#formatting)\n\n### Parsing\n\n#### `dateTimeFromFormat`\n\nTransforms an arbitrarily formatted date into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ '02 Jan 2006' | dateTimeFromFormat:'dd LLL yyyy' }}\n{{ 'January 2, 2006 3:04 PM' | dateTimeFromFormat:'LLLL d, yyyy h:mm a' }}\n```\n\n#### `dateTimeFromHttp`\n\nTransforms a HTTP-style date into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ 'Monday, 02-Jan-06 22:04:05 GMT' | dateTimeFromHttp }}\n{{ 'Mon, 02 Jan 2006 22:04:05 GMT' | dateTimeFromHttp }}\n```\n\n#### `dateTimeFromIso`\n\nTransforms an ISO 8601 date into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ '2006-01-02' | dateTimeFromIso }}\n{{ '2006-01-02T15' | dateTimeFromIso }}\n{{ '2006-01-02T15:04:05-07:00' | dateTimeFromIso }}\n```\n\n#### `dateTimeFromJsDate`\n\nTransforms a JavaScript Date object into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ date | dateTimeFromJsDate }}\n```\n\n#### `dateTimeFromMilliseconds`\n\nTransforms a timestamp in milliseconds from epoch into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ date | dateTimeFromMilliseconds }}\n```\n\n#### `dateTimeFromRfc2822`\n\nTransforms a date formatted according to RFC 2822 into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ 'Mon, 02 Jan 2006 15:04:05 -0700' | dateTimeFromRfc2822 }}\n```\n\n#### `dateTimeFromSql`\n\nTransforms a SQL-style date into a DateTime that can be used with the non-parsing pipes:\n\n```\n{{ '2006-01-02 15:04:05.000-0700' | dateTimeFromSql }}\n```\n\n#### `durationFromIso`\n\nTransforms an ISO 8601 duration string into a Duration that can be used with the non-parsing pipes:\n\n```\n{{ 'P2Y4M6D' | durationFromIso }}\n```\n\n#### `durationFromIsoTime`\n\nTransforms an ISO 8601 time string into a Duration that can be used with the non-parsing pipes:\n\n```\n{{ '02:04:06.800' | durationFromIsoTime }}\n```\n\n#### `durationFromMilliseconds`\n\nTransforms a duration in milliseconds into a Duration that can be used with the non-parsing pipes:\n\n```\n{{ 24000 | durationFromMilliseconds }}\n```\n\n### Math\n\n#### `dateTimeEarliest`\n\nSelects the earliest (minimum) from a list of DateTimes.\n\n```\n{{ [early, earliest, earlier] | dateTimeEarliest }}\n```\n\n#### `dateTimeLatest`\n\nSelects the latest (maximum) from a list of DateTimes.\n\n```\n{{ [late, latest, later] | dateTimeLatest }}\n```\n\n#### `durationLongest`\n\nSelects the longest (maximum) from a list of Durations.\n\n```\n{{ [long, longest, longer] | durationLongest }}\n```\n\n#### `durationShortest`\n\nSelects the shortest (minimum) from a list of Durations.\n\n```\n{{ [short, shortest, shorter] | durationShortest }}\n```\n\n### Time zones and offsets\n\nIn general, all time zone and offset operations change the DateTime’s zone but keep the underlying timestamp. For more information, see the [Luxon docs][changing-zones].\n\n#### `dateTimeToLocal`\n\nSets the zone of the DateTime to the local zone:\n\n```\n{{ date | dateTimeToLocal }}\n```\n\n#### `dateTimeToUtc`\n\nSets the zone of the DateTime to the Coordinated Universal Time zone:\n\n```\n{{ date | dateTimeToUtc }}\n```\n\n### Formatting\n\n#### `dateTimeToFormat`\n\nTransforms a DateTime into an arbitrarily formatted string:\n\n```\n{{ date | dateTimeToFormat:'MMMM d, yyyy' }}\n```\n\n#### `dateTimeToLocaleString`\n\nTransforms a DateTime into an human-readable, internationalized string:\n\n```\n{{ date | dateTimeToLocaleString:DateTime.DATETIME_FULL }}\n\n{{ date | dateTimeToLocaleString:{\n                                    year: 'numeric',\n                                    month: 'long',\n                                    day: 'numeric',\n                                    hour: 'numeric',\n                                    minute: '2-digit',\n                                    timeZoneName: 'short'\n                                  } }}\n```\n\nThe pipe takes [`Intl.DateTimeFormat`][intl-datetimeformat] as a parameter.\n\n#### `dateTimeToIso`\n\nTransforms a DateTime into an ISO 8601 date:\n\n```\n{{ date | dateTimeToIso }}\n```\n\nAlso available: `dateTimeToIsoDate`, `dateTimeToIsoTime`, and `dateTimeToIsoWeekDate`.\n\n#### `dateTimeToJsDate`\n\nTransforms a DateTime into a JavaScript date:\n\n```\n{{ date | dateTimeToJsDate }}\n```\n\nWorks with Angular’s [`DatePipe`][angular-datepipe]:\n\n```\n{{ date | dateTimeToJsDate | date:'fullDate' }}\n```\n\n#### `dateTimeToRelative` and `dateTimeToRelativeCalendar`\n\nTransforms a DateTime into a relative time:\n\n```\n{{ date | dateTimeToRelative:{ unit: 'day', style: 'long' } }}\n{{ date | dateTimeToRelativeCalendar:{ unit: 'month' } }}\n```\n\nThe unit and style parameters are optional.\n\n#### `dateTimeToSql`\n\nTransforms a DateTime into an SQL date string:\n\n```\n{{ date | dateTimeToSql }}\n```\n\n#### `durationToFormat`\n\nTransforms a Duration into an arbitrarily formatted string:\n\n```\n{{ duration | durationToFormat:'mm:ss.SSS' }}\n```\n\n#### `durationToHuman`\n\nTransforms a Duration into a human-readable string with all units included:\n\n```\n{{ duration | durationToHuman }}\n```\n\n#### `durationToIso`\n\nTransforms a Duration into an ISO 8601 duration string:\n\n```\n{{ duration | durationToIso }}\n```\n\n#### `durationToIsoTime`\n\nTransforms a Duration into an ISO 8601 time string:\n\n```\n{{ duration | durationToIsoTime }}\n```\n\n[intl-datetimeformat]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n[angular-datepipe]: https://angular.io/api/common/DatePipe\n[changing-zones]: https://moment.github.io/luxon/#/zones?id=changing-zones\n[luxon]: https://moment.github.io/luxon/\n[relative-time-polyfill]: https://github.com/catamphetamine/relative-time-format\n[relative-time-proposal]: https://github.com/tc39/proposal-intl-relative-time\n","funding_links":[],"categories":["Table of contents"],"sub_categories":["Third Party Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstelljes%2Fluxon-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdstelljes%2Fluxon-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdstelljes%2Fluxon-angular/lists"}