New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@annotation/ng-parse

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@annotation/ng-parse

Angular date parsing/formatting utility

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

Welcome to @annotation/ng-parse 👋

Version License: MIT

Angular parsers

🏠 Homepage

Install

yarn add @annotation/ng-parse
## OR ##
npm install @annotation/ng-parse --save

API

Date parser

functionparametersreturn valuedescription
parseDatevalue: string, format: BasicDateFormat OR string, locale: string, oldValue ?: DateDateFormats value in defined format and locale and returns Date
getDateFormatParserlocale: string, format: BasicDateFormat OR stringDateParserReturns 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.
toDatevalue: string OR Date Or numberDateReturns Date from Date, number (timestamp) or ISO string (yyyy-MM-ddTHH:mm:ss:sss)
Examples for date parser functions
  • parseDate
const date: Date = parseDate('01.01.2021', 'dd.MM.yyyy', 'sk')
  • getDateFormatParser
const parser: DateParser = getDateFormatParser('sk', 'dd.MM.yyyy');
const date: Date = parser.parseDate('01.01.2021');
const parts: DateType[] = parser.types;

const hasYear = parts.includes(DateType.FullYear); // true
const hasMinutes = parts.includes(DateType.Minutes) // false
  • toDate
const dateFromMs: Date = toDate(1623926493809);
const dateFromDate: Date = toDate(new Date()); 
const dateFromISO8601_1: Date = toDate('2021-06-16T23:54:08+00:00'); 
const dateFromISO8601_2: Date = toDate('2021-06-16T23:54:08Z'); 
Types for date parsers
type/interfacedefinition
DateTypeFullYear,Month,Date,Hours_24,Hours_12,Minutes,Seconds,FractionalSeconds,DayOfWeek,DayPeriods,Eras,TimeZoneOffset
BasicDateFormatshort', 'medium', 'long', 'full', 'shortDate', 'mediumDate', 'longDate', 'fullDate', 'shortTime', 'mediumTime', 'longTime', 'fullTime'
DatePartFormatsee https://angular.io/api/common/DatePipe#custom-format-options
DateParsererrorMsg: string, types: DateType[], parseDate: (text: string, oldValue?: Date) => Date

Authors

👤 Pavol Slany

👤 Martin Filo

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

FAQs

Package last updated on 11 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc