Update index.js#98
Conversation
add local date format in date token by :date[local]
|
Hi @lijason1121, thanks for your pull request! I have a few comments on this so far:
|
add 'locale' format for :date.
|
hi @dougwilson |
|
Hi @lijason1121, it looks like the contents of the pull request are very different now :) The date formats has always been a form on debate here, and in reality, we only provide the ones that access log analyzers can read out of the box and recommend you simply define the token for the format you want, which is the whole point of the token method: var morgan = require('morgan')
morgan.token('date', function () {
var dateTime = new Date()
var date = dateTime.getDate()
var hour = dateTime.getHours()
var mins = dateTime.getMinutes()
var secs = dateTime.getSeconds()
var year = dateTime.getFullYear()
var month = dateTime.getMonth() + 1;
return year + '-' + pad2(month) + '-' + pad2(date)
+ ' ' + pad2(hour) + ':' + pad2(mins) + ':' + pad2(secs)
}) |
add 'locale' format by :date[locale]