MomentJS Clock

Size
2,940 Kb
Views
18,216

How do I make an momentjs clock?

This pen utilizes Moment.js and React.js to render a unix timestamp as a pretty date.. What is a momentjs clock? How do you make a momentjs clock? This script and codes were developed by Joshua Michael Waggoner on 11 October 2022, Tuesday.

MomentJS Clock Previews

MomentJS Clock - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>MomentJS Clock</title> <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.1.0/moment.min.js"></script> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="clock"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

MomentJS Clock - Script Codes CSS Codes

@import url(https://fonts.googleapis.com/css?family=Lekton|Nova+Mono);
body { max-height: 500px; background-image: url("http://www.csiss.org/map-projections/microcam/wtpolit.gif");
}
#clock { font-size: 3em; font-family: 'Lekton'; text-align: left; margin-left: 100px; margin-top: 5%;
}

MomentJS Clock - Script Codes JS Codes

"use strict";
// Moment.js stuff...
var FORMAT = "ddd MMM Do, YYYY hh:mm:ss A";
// Returns a nice date...
var getTime = function getTime(t) { return moment.unix(t).format(FORMAT);
};
// Clock component
var Clock = function Clock(props) { return React.createElement( "p", null, getTime(props.date) );
};
// Render at interval of half-second...
setInterval(function () { var time = Math.floor(Date.now() / 1000); React.render(React.createElement(Clock, { date: time }), document.getElementById('clock'));
}, 500);
MomentJS Clock - Script Codes
MomentJS Clock - Script Codes
Home Page Home
Developer Joshua Michael Waggoner
Username rabbitfighter81
Uploaded October 11, 2022
Rating 3
Size 2,940 Kb
Views 18,216
Do you need developer help for MomentJS Clock?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Joshua Michael Waggoner (rabbitfighter81) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!