Web Technologies

The Moment.js is an JavaScript library that helps you manage dates. Sometimes It is bit difficult to handle date and time.
Moment.js, the impressive JavaScript library for validating, parsing and manipulating dates and times,time zones.
The moment object in Moment.js is mutable.

Moment was designed to work both in the browser and in Node.js. Moment.js is available on cdnjs.com and on jsDelivr.

Moment.js has robust support for internationalization.

npm install moment --save   # npm
yarn add moment             # Yarn
Install-Package Moment.js   # NuGet
spm install moment --save   # spm
meteor add momentjs:moment  # meteor
bower install moment --save # bower (deprecated)

Get Current Date and Time

const currentdate = moment();

Manipulating Date 

We can achieve this manipulation via the add() and subtract() methods.

#Add Syntax

moment().add(Number, String);

#Subtract Syntax

moment().subtract(Number, String);

#Calculating the Difference Between Dates

const moment = require('moment');
const dateB = moment('1990-07-01');
const dateC = moment('2019-07-19');
console.log('Difference is ', dateB.diff(dateC, 'days'), 'days');
console.log('Difference is ', dateB.diff(dateC, 'months'), 'months');
console.log('Difference is ', dateB.diff(dateC, 'years'), 'years');

Format Dates
moment().format('MMMM DD YYYY, h:mm:ss a'); // July 14 2019, 12:18:13 pm
moment().format('dddd');                    // Sunday
moment().format("MMM DD YY");               // Jul 14 19
moment().format('YYYY [escaped] YYYY');     // 2019 escaped 2019
moment().format();                         // 2019-07-14T12:22:46+05:30

Date Comparison Methods

Comparison methods are isBefore(), isAfter(), and isSame(). These methods return boolean values that are indicating if one date is before, after, or equal to another date.

const moment = require('moment');
console.log(moment('2019-07-14').isAfter('2019-07-13')); // returns false
console.log(moment('2019-07-14').isAfter('2019-07-20')); // returns true


moment.parseZone is equivalent to parsing the string and using moment#utcOffset to parse the zone.

Checking current moment.js locale

This is as simple as calling moment.locale without any parameters.

moment.locale(); // returns 'en'

UTC Offset

This function will return the current offset variation with respect to the system server timezone.

moment().utcOffset(); // (-240, -120, -60, 0, 60, 120, 240, etc.)

Changing locale globally

Moment.js has robust support for internationalization. We easily change the locale as required.





Web Technologies

The backend web frameworks comprise of languages and tools utilized in server-side programming in a web application development condition. The way to the effective back end development of web applications is picking the right stack, adapting new databases and programming languages and understanding the server engineering too.


Express.js, or simply Express, is a web application framework for Node.js, released as free and open-source software under the MIT License. It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js.

Express prides itself as a minimal, fast and unopinionated frameworks. It provides some core framework functionalities without obscuring the features of Node and leverages the powerful performance of the asynchronous Node.js. It’s also quite flexible and supports full applications as well as REST API as well.


  1. Powerful routing API
  2. Good documentation
  3. Supportive community


Laravel is a PHP based backend framework which prides itself on its beautiful syntax, ability to accommodate large teams, and the functionality of its modern toolkit. Laravel follows the MVC architectural pattern and was built to facilitate extensive backend development. Laravel also offers its own database migration system and has a robust ecosystem.


  1. Simple and fast routing engine
  2. Comes with its own CLI
  3. Powerful template system (Blade)
  4. Good documentation


A free, open-source backend web development framework, Django is widely used for the rapid development of APIs and high-end backend web applications. Named after the renowned guitarist, Django Reinhardt, this Python framework was created in 2003. The Django framework supports the quick development of backend web applications with very less coding. The efficiency of this Python web development framework is proved from the fact that it is used by some of the busiest applications on the web.

Besides taking off the web development hassles, Django has many other features that woo the developers across the world.


  1. Highly customizable
  2. Explained documentation
  3. The popular tool with extensive community
  4. Clear and defined MVC organization


Spring is a Model-View-Controller framework that uses Java, the all-time popular language. It’s used by websites like Wix, TicketMaster, and BillGuard. Spring possess a lot of sister projects that boost its performance and let you scale your business easily. The fact that it uses Java, a strongly typed language, is a serious pro for many web developers. The learning curve might be quite steep tho, especially if you don’t know Java.


  1. Create stand-alone Spring applications
  2. Highly scalable
  3. Great documentation
  4. Built for large scale applications that use a cloud approach
  5. Extensive ecosystem

Ruby on Rails

Released in 2004, Ruby on Rails is a free, open-source MVC backend web development framework. Ruby has always been considered to be one of the most developer-friendly languages and the Rails framework combines the capabilities of Ruby language. This framework provides developers with pre-defined solutions to perform repetitive tasks. It supports super-fast development and offers almost every component that a developer looks for in an advanced framework. It has been used to build the backend of renowned applications such as GitHub, Airbnb, Shopify, and Zendesk.

  1. Good conventions
  2. A number of plugins available
  3. VPS hosting service
  4. Massive community


CakePHP is one of the first PHP frameworks to be released back in 2005. Since then, it has come a long way and is now known as a modern PHP framework made to allow developers to build quickly. CakePHP uses clean MVC conventions and is highly extensible making it a great choice for building both large and small applications.


  1. Allows you to build rapidly
  2. Comes with “batteries included”
  3. Built with security in mind
  4. No complicated configuration required to get started

Microdot Framework
The Microdot framework is gradually gaining traction among developers worldwide as it helps in creating reliable, scalable microservices. An open-source .NET framework, Microdot allows developers to focus on coding as it offers well-written documents on microservices pattern and architecture. If your organization uses platforms developed by Microsoft and in case you plan to build microservices, Microdot is incontrovertibly the best option.


  1. Interoperability
  2. Common Language Runtime engine (CLR)
  3. Language independence
  4. Base Class Library
  5. Simplified deployment
  6. Security
  7. Portability

Flask Framework

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Extensions are updated far more regularly than the core Flask program.


  1. Contains development server and debugger
  2. Integrated support for unit testing
  3. RESTful request dispatching
  4. Uses Jinja2 templating
  5. Support for secure cookies (client side sessions)
  6. 100% WSGI 1.0 compliant
  7. Unicode-based
  8. Extensive documentation
  9. Google App Engine compatibility
  10. Extensions available to enhance features desired


Web Technologies

Angular 7 is actually a typescript based open source full-stack web application framework which makes you to create reactive single page applications (SPA). Angular 7 is completely based on components. Let see about Angular 7 installation and new features.


  1. Install the latest version of node.js (https://nodejs.org/en/download)
  2. Install visual studio code (https://code.visualstudio.com/download)

Steps to check the installation of Node and NPM

To verify the versions of Node and NPM, you have to execute the following 2 commands using the command prompt window.

node -v
npm –v

To install Angular 7 using npm,

npm install -g @angular/cli

For Linux or Mac, we should add sudo to grant the installation permission.

sudo npm i @angular/[email protected] -g

Install Angular 7 Beta globally on the machine. Open the terminal and type the below command.

Invoke the tool on the command line through the ng executable.


ng help
ng generate --help

To create, build, and serve a new basic Angular project. The following commands are:

ng new my-first-project
cd my-first-project
ng serve

A “production” configuration is created by default when you use the CLI to create the project and you can use that configuration by specifying the –-prod option.


ng build --prod

Angular 7 Components

The most basic building block of your Angular 7 application (and this is a concept that’s not new) is the component .

  1. The html template.
  2. The styling(SASS,CSS) etc..

Features of Angular 7

  1. Virtual Scrolling
  2. Drag and drop
  3. Improved accessibility of select

Virtual Scrolling

Virtual Scrolling loads and unloads elements from the DOM based on the visible parts of a list, making it possible to build very fast experiences for users with very large scrollable lists.


<cdk-virtual-scroll-viewport itemSize ="50" class="example-viewport">
<div *cdkVirtualFor="let item of items" class="example-item">{{item}}</div>

Drag and Drop

Drag and drop support is now in the CDK and includes automatic rendering as the user moves items and helper methods for reordering lists.

(moveItemInArray) and transferring items between list (transferArrayItem).

For html,

<div cdkDropList class="list" (cdkDropListDropped)="drop($ event)">
<div class="box" *ngFor="let movie of movies" cdkDrag>{{movie}}</div>

For ts,


Improved accessibility of select

Improve the accessibility of your application by using a native select element inside of a mat-form-field. <mat-select> is a form control for selecting a value from a set of options, similar to the native <select> element.

Performance Improvements

We inclued the reflect-metadata polyfill in production ,which is only needed in development. These default bundle size can be easily changed in your angular.json file

by changing the bundle size in the angular.json file.


Angular 7 Templating

<app-nav> is a component decorator , there’s a selector property bound to the value of app-nav.

Interpolation is executed by wrapping the name of a property that’s defined in the component between {{ }}.



With Angular 7, a new major release has come out, which is having many small improvements and designed by maintaining the dependencies and other performance improvements .


Web Technologies

This is the complete list, yet some of the best practices we follow when we code. Keep reading

Declaration should ends with semicolons properly
Variable/function declarations should always with var keyword

var myfunction = function() {};


The best tool for linting your JavaScript code is JSHint.(https://jshint.com/)

Don’t Use Short-Hand

The curly braces should be omitted is with one-liners.
if(1 + 1 === 2) return 'correct'; // one-line
if(1 + 1 === 2) {x=true; anotherFunctionCall();};

=== Instead of ==
Working with == and !=, leads into issues while using different types, so better way is to use === and !==

Avoid long argument list

Use a single object as parameter , it helps in handling optional parameters.

function getRegisteredUsers ({ fields, include, fromDate, toDate }) { // Implementation}

fields: ['name','email'],
include: ['favorites'],
fromDate: '2019-05-05',
toDate: '2019-05-10'

Optimize loops

Loops may slow down and the most common mistake is to read the length attribute of an array at every iteration.

Avoid nesting

Nesting is hard to follow on complex logic, little bit confusing too.

Place Scripts at the Bottom of web Page

Always place the scripts at end bottom of the page, which helps to load the page as quick as possible.

Use {} Instead of New Object()

There are several ways available to create a object. Best way I suggest is to use {} instead of new Object();
var a = {}; // Correct
var a = new Object(); // wrong

Use [] Instead of New Array()

Best way to declare a array is to use [] instead of new Array();
var teams = ['a','b','c'];

Comment the Code

Comment or describe(shortly) the code for better understanding. It may helps while we visit the code later.


Web Technologies

jsreport is the open source platform for designing and rendering reports.It allows you to create various reports in various formats like PDF, Excel, HTML.  It also includes advanced reporting features like user management, REST API.


The jsreport can be installed like other npm modules. You can run the npm command after the installation of Nodejs.

npm install -g jsreport-cli

The jsreport needs to be initialized and configured with the following commands.

jsreport init
jsreport configure

We need to configure the things like protocol, port, Authentication and permission for jsreport to access the local storage.

To start the jsreport server use the following command and point your browser to the specified port.The default port for the jsreport server is http://localhost:5488

 jsreport start 

How to define data ?

Before creating a pdf invoice layout, you should prepare some sample data that will be used later to preview. The sample data should be in the form of json object.

jsreport make the thing easy by providing a user interface for the developers. You can get sample report format at the user interface.

Defining report template

Template defines what the result report is going to be look like and is used together with the input data every time you render a new report. You can create a report template again from the entity tree panel on the top left.

For the invoice tutorial, the first thing you need to do is associate the sample data you previously defined with the newly created template.We can also define styling for the report like doing in the normal html page.


jsreport supports various reports and various output formats. To specify output format choose a jsreport recipe. Recipe doesn’t only define the output format, but also how it is produced. You can define an html template and then just by changing the recipe it will produce reports in the format of pdf, html or excel.

The easiest way to create a pdf invoice is to use html to pdf conversion provided by chrome-pdf recipe.You can find the recipes in the bottom left corner. jsreport uses javascript templating engines to define report layout. You can bind input data, use loops, conditions or javascript helpers.The template engines which are used in the jsreport are handlebars, jsrender, EJS,Pug.

Test the Report:

After defining the template, data and recipe you can test the jsreport by clicking the RUN . Now the template will provide the specified structure for the report along with the data. You can also download the data by clicking the download button.

For more reference please visit:

Learn jsreport 
jsreport playground