so i am doing Timestamp Microservice
and here is my code
var express =require('express');
var moment = require('moment');
var app =express();
app.get('/',function(req,res){
res.sendFile(__dirname+'/info.html');
})
app.get('/:input',function(req,res){
// res.send(req.params.input);
//moment.unix(1450137600).format("MMM D YYYY");
//moment("December 15, 2015").format('X');
var isValidDate =moment(''+req.params.input).isValid();
var isValidUnixDate =moment.unix(''+req.params.input).isValid();
// console.log(req.parms.input);
if(isValidDate || isValidUnixDate){
if(isValidUnixDate){
res.send('unix :'+req.params.input+' natural: '+moment.unix(''+req.params.input).format('MMM D YYYY'));
}else{
res.send('unix :'+moment(''+req.params.input).format('X')+' natural: '+req.params.input);
}
}else{
res.send('invalid date. Try again.');
}
})
app.listen(8080);
now it is working fine. it give me the output as I wanted
but in back end I got some warning in console. Can’t fig out exactly why this happening?
all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://moment
js.com/guides/#/warnings/js-date/ for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: asd, _f: undefined, _strict: undefined, _locale: [object Object]
Error
at Function.createFromInputFallback (D:\git\fcc\time-stamp\node_modules\moment\moment.js:318:94)
at configFromString (D:\git\fcc\time-stamp\node_modules\moment\moment.js:2080:15)
at configFromInput (D:\git\fcc\time-stamp\node_modules\moment\moment.js:2444:9)
at prepareConfig (D:\git\fcc\time-stamp\node_modules\moment\moment.js:2427:9)
at createFromConfig (D:\git\fcc\time-stamp\node_modules\moment\moment.js:2394:40)
at createLocalOrUTC (D:\git\fcc\time-stamp\node_modules\moment\moment.js:2481:12)
at createLocal (D:\git\fcc\time-stamp\node_modules\moment\moment.js:2485:12)
at hooks (D:\git\fcc\time-stamp\node_modules\moment\moment.js:16:25)
at D:\git\fcc\time-stamp\app.js:14:22
at Layer.handle [as handle_request] (D:\git\fcc\time-stamp\node_modules\express\lib\router\layer.js:95:5)
what is the solution?
should i need to worry about too much or move on ?