{"id":23416800,"url":"https://github.com/ljmerza/ngx-dayjs","last_synced_at":"2025-04-12T08:52:52.004Z","repository":{"id":57140649,"uuid":"131323919","full_name":"ljmerza/ngx-dayjs","owner":"ljmerza","description":"dayjs pipes for Angular","archived":false,"fork":false,"pushed_at":"2018-05-14T16:03:43.000Z","size":204,"stargazers_count":8,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T08:52:46.760Z","etag":null,"topics":["angular","dayjs","dayjs-pipes","javascript","library","module","pipe","time","timzone"],"latest_commit_sha":null,"homepage":"https://github.com/xx45/dayjs","language":"TypeScript","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/ljmerza.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-27T17:02:55.000Z","updated_at":"2020-05-03T18:59:25.000Z","dependencies_parsed_at":"2022-09-01T23:50:25.878Z","dependency_job_id":null,"html_url":"https://github.com/ljmerza/ngx-dayjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljmerza%2Fngx-dayjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljmerza%2Fngx-dayjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljmerza%2Fngx-dayjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljmerza%2Fngx-dayjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljmerza","download_url":"https://codeload.github.com/ljmerza/ngx-dayjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543882,"owners_count":21121838,"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":["angular","dayjs","dayjs-pipes","javascript","library","module","pipe","time","timzone"],"created_at":"2024-12-22T22:16:46.874Z","updated_at":"2025-04-12T08:52:51.987Z","avatar_url":"https://github.com/ljmerza.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ngx-dayjs\n\ndayjs pipes for Angular\n\n[![Build Status](https://travis-ci.org/ljmerza/ngx-dayjs.svg?branch=master)](https://travis-ci.org/ljmerza/ngx-dayjs)\n\nInstallation\n------------\n\n`npm install --save ngx-dayjs`\n\n### For System.js users:\n\nFirst you need to install dayjs:\n\n`npm install dayjs --save`\n\nDon't forget to update your systemjs.config.js:\n\n```\npackages: {\n            app: {\n                main: './main.js',\n                defaultExtension: 'js'\n            },\n            'dayjs': {\n                main: './dayjs.js',\n                defaultExtension: 'js'\n            },\n            'ngx-dayjs': {\n                main: './index.js',\n                defaultExtension: 'js'\n            }\n        }\n```\n\nUsage\n-----\n\nImport `dayjsModule` into your app's modules:\n\n``` typescript\nimport { dayjsModule } from 'ngx-dayjs';\n\n@NgModule({\n  imports: [\n    dayjsModule\n  ]\n})\n```\n\nThis makes all the `ngx-dayjs` pipes available for use in your app components.\n\nAvailable pipes\n---------------\n\n## amFromUnix pipe\n\n``` typescript\n@Component({\n  selector: 'app',\n  template: `\n    Last updated: {{ (1456263980 | amFromUnix) | amDateFormat:'hh:mmA'}}\n  `\n})\n```\n\nPrints `Last updated: 01:46PM`\n\n## amParse pipe\n\nParses a custom-formatted date into a dayjs object that can be used with the other pipes.\n\n``` typescript\n@Component({\n  selector: 'app',\n  template: `\n    Last updated: {{'24/01/2014' | amParse:'DD/MM/YYYY' | amDateFormat:'LL'}}\n  `\n})\n```\n\nPrints `Last updated: January 24, 2016`\n\n## amDifference pipe\n\n``` typescript\n@Component({\n  selector: 'app',\n  template: `\n    Expiration: {{nextDay | amDifference: today :'days' : true}} days\n  `\n})\n```\nPrints `Expiration: 1 day`\n\n## amAdd and amSubtract pipes\n\nUse these pipes to perform date arithmetics. See [dayjsjs docs](http://dayjsjs.com/docs/#/manipulating/add/) for details.\n\n``` typescript\n@Component({\n  selector: 'app',\n  template: `\n    Expiration: {{'2017-03-17T16:55:00.000+01:00' | amAdd: 2 : 'hours' | amDateFormat: 'YYYY-MM-DD HH:mm'}}\n  `\n})\n```\nPrints `Expiration: 2017-03-17 18:55`\n\n``` typescript\n@Component({\n  selector: 'app',\n  template: `\n    Last updated: {{'2017-03-17T16:55:00.000+01:00' | amSubtract: 5 : 'years' | amDateFormat: 'YYYY-MM-DD HH:mm'}}\n  `\n})\n```\nPrints `Last updated: 2012-03-17 16:55`\n\n\nComplete Example\n----------------\n\n``` typescript\nimport { NgModule, Component } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { dayjsModule } from 'ngx-dayjs';\n\n@Component({\n  selector: 'app',\n  template: `\n    Last updated: \u003cb\u003e{{myDate | amSubtract:timeLeft}}\u003c/b\u003e\n  `\n})\nexport class AppComponent {\n  myDate: Date;\n\n  constructor() {\n    this.myDate = new Date();\n  }\n}\n\n@NgModule({\n  imports: [\n    BrowserModule,\n    dayjsModule\n  ],\n  declarations: [ AppComponent ]\n  bootstrap: [ AppComponent ]\n})\nclass AppModule {}\n\nplatformBrowserDynamic().bootstrapModule(AppModule);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljmerza%2Fngx-dayjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljmerza%2Fngx-dayjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljmerza%2Fngx-dayjs/lists"}