ng-basics

1.0.6 • Public • Published

What is Ng-Basics :

Ng-basics Allow angular user to directly implement some commonly used Javascript functions such as time formats and object handling functions ..etc

Installation :

npm i ng-basics

or

npm i ng-basics --save

How to use :

In your .ts file import ng-basics after installation
.....
.....

import * as basics from 'ng-basics';

.....
.....

let d = new Date();
let basic = new basics();
console.log(basic.getDate_Normal(d),basic.getDate_FullFormat(d));

Time/Date Handling Methods

Note:
For all these functions to work you have to pass a new Date instance
ex: let d - new Date();
let date = getDate_Normal(d);

  • getDate_Normal(timeInstance) => returns Format " 2020-02-03 *
  • getDate_FullFormat(timeInstance) => returns Format " Tuesday,4 February 2020 *
  • getDate_MonthYear(timeInstance) => returns Format " April 2020*
  • getDate_Time(timeInstance) => returns Format " 9:03:18 PM*
  • getDate_ServerFormat(timeInstance) => returns Format " 2020-02-03 00:00:00*
  • getDate_YearMonth(timeInstance) => returns Format " 2020-02*
  • getYearsToNow(timeInstance) => returns an array of years from 1990 to current year [{'year': 1990}....{'year': ...}]

Object Handling Methods

Note: For all these functions to work you have to pass the object that needed to be formatted

  • replaceNULL(obj) => returns the passed object with string null replaced by real NUL*
  • nullToZero(obj) => returns the passed object nulls replaced with *
  • removeNull(obj) => returns the passed object that all null properties are removed

Package Sidebar

Install

npm i ng-basics

Weekly Downloads

1

Version

1.0.6

License

ISC

Unpacked Size

5.99 kB

Total Files

3

Last publish

Collaborators

  • ananthugvr