Moment JS

Example of parsing and formatting a Date with Moment JS.

by Aswin Devarajan

HTML

<script src="http://momentjs.com/downloads/moment.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>
</head>
<body>
<link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Open+Sans">

<div id="container">
	<div id="header">
		<div id="logo">
			<img src="http://placehold.it/230x70&text=logo" alt="">
		</div>
		<div id="reference">
			<h3><strong>Facture</strong></h3>
			<h4>Réf. : FA1703-00001</h4>
			<p>Date facturation : 20/03/2017</p>
		</div>
	</div>

	<div id="fromto">
		<div id="from">
			<p>
				<strong>Your company</strong><br>
				8 avenue des Champs Elysées <br>
				75000 Paris <br><br>
				Tél.: 01 00 00 00 00 <br>
				Email: [email protected] <br>
				Web: www.website.com
			</p>
		</div>
		<div id="to">
			<p>
				<strong>John Doe</strong><br>
				10 rue Charles Rouxel<br>
				77014 Paris
			</p>
		</div>
	</div>

	<div id="items">
		<p>Montants exprimés en Euros</p>
		<table>
			<tr>
				<th>Item...