{"id":20754470,"url":"https://github.com/annotationsro/ng-a-parse","last_synced_at":"2026-02-08T08:02:56.029Z","repository":{"id":57097842,"uuid":"350236300","full_name":"AnnotationSro/ng-a-parse","owner":"AnnotationSro","description":"Angular parsers","archived":false,"fork":false,"pushed_at":"2024-11-11T09:49:21.000Z","size":1198,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-17T20:48:15.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AnnotationSro.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}},"created_at":"2021-03-22T06:45:54.000Z","updated_at":"2024-11-11T09:49:25.000Z","dependencies_parsed_at":"2024-04-26T18:42:01.062Z","dependency_job_id":"221ca34b-e96b-4a05-bca3-f32e57c340fb","html_url":"https://github.com/AnnotationSro/ng-a-parse","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnotationSro%2Fng-a-parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnotationSro%2Fng-a-parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnotationSro%2Fng-a-parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnnotationSro%2Fng-a-parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnnotationSro","download_url":"https://codeload.github.com/AnnotationSro/ng-a-parse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234461235,"owners_count":18836993,"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":[],"created_at":"2024-11-17T09:17:56.281Z","updated_at":"2025-09-27T21:32:21.403Z","avatar_url":"https://github.com/AnnotationSro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome to @annotation/ng-parse 👋\n[![Version](https://img.shields.io/npm/v/@annotation/ng-parse.svg)](https://www.npmjs.com/package/@annotation/ng-parse)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)\n\n\u003e Angular parsers\n\n### 🏠 [Homepage](https://github.com/AnnotationSro/ng-a-parse)\n\n## Install\n\n```sh\nyarn add @annotation/ng-parse\n## OR ##\nnpm install @annotation/ng-parse --save\n```\n\n## API\n\n### Date parser\n\n| function            | parameters                                                                           | return value | description                                                                                                                                                                                              |\n|---------------------|--------------------------------------------------------------------------------------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| parseDate           | `value: string, format: BasicDateFormat OR string, locale: string, oldValue ?: Date` | `Date`       | Formats `value` in defined `format` and `locale` and returns `Date`                                                                                                                                      |\n| getDateFormatParser | `locale: string, format: BasicDateFormat OR string`                                  | `DateParser` | Returns prepared `DateParser` capable to manually parse given string with `DateFormat.parseDate(value, oldValue)` method. Also contains `DateType[]` which helps to identify what parts are in `format`. |\n| toDate              | `value: string OR Date Or number`                                                    | `Date`       | Returns `Date` from `Date`, `number` (timestamp) or `ISO string` (yyyy-MM-ddTHH:mm:ss:sss)                                                                                                               |\n\n#### Examples for date parser functions\n* parseDate\n```typescript\nconst date: Date = parseDate('01.01.2021', 'dd.MM.yyyy', 'sk')\n```\n\n* getDateFormatParser\n\n```typescript\nconst parser: DateParser = getDateFormatParser('sk', 'dd.MM.yyyy');\nconst date: Date = parser.parseDate('01.01.2021');\nconst parts: DateType[] = parser.types;\n\nconst hasYear = parts.includes(DateType.FullYear); // true\nconst hasMinutes = parts.includes(DateType.Minutes) // false\n```\n* toDate\n```typescript\nconst dateFromMs: Date = toDate(1623926493809);\nconst dateFromDate: Date = toDate(new Date()); \nconst dateFromISO8601_1: Date = toDate('2021-06-16T23:54:08+00:00'); \nconst dateFromISO8601_2: Date = toDate('2021-06-16T23:54:08Z'); \n```\n\n#### Types for date parsers\n| type/interface    | definition                                                                                                                               |\n|-------------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| `DateType`        | `FullYear,Month,Date,Hours_24,Hours_12,Minutes,Seconds,FractionalSeconds,DayOfWeek,DayPeriods,Eras,TimeZoneOffset`                       |\n| `BasicDateFormat` | `short', 'medium', 'long', 'full', 'shortDate', 'mediumDate', 'longDate', 'fullDate', 'shortTime', 'mediumTime', 'longTime', 'fullTime'` |\n| `DatePartFormat`  | see https://angular.io/api/common/DatePipe#custom-format-options                                                                         |\n| `DateParser`      | `errorMsg: string, types: DateType[], parseDate: (text: string, oldValue?: Date) =\u003e Date`                                                |\n\n## Authors\n\n👤 **Pavol Slany**\n\n* Website: www.annotation.sk\n* Github: [@slany](https://github.com/slany)\n\n👤 **Martin Filo**\n\n* Website: www.annotation.sk\n* Github: [@Chiff](https://github.com/Chiff)\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n\n***\n_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannotationsro%2Fng-a-parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fannotationsro%2Fng-a-parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannotationsro%2Fng-a-parse/lists"}