Closed baaswietse closed 4 years ago
@baaswietse Now you can, I just added it:
log.configure ({
time: {
yes: true,
format: 'locale',
locale: 'en-US',
options: { timeZone: 'America/Denver' }
}
})
It is the same options as described in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
Time zones can be looked up here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
P.S. You can also provide a custom printer, if the built-in formatter doesn't do the exact thing you need:
log.configure ({ time: { yes: true, print: date => { /* format the date as needed */ }})
Thank you so much for the quick response! Works like a charm :)
Just one side note, when defining the locale: 'be-NL' (I'm from Belgium). The time string is formatted correctly but the date string isn't, we use this format: DD/MM/YYY, while in the logs it stays as MM/DD/YYY
we use this format: DD/MM/YYY, while in the logs it stays as MM/DD/YYY
@baaswietse Try nl-BE
instead of be-NL
:)
Oh wow, thank you sir!
Is there any way to define your current timezone or an offset? Right now the timestamps from the logger are 2 hours behind.
I couldn't find this in the docs.
Thanks.