Made getTimezone into an exported lambda.
This commit is contained in:
parent
1c632dcf80
commit
efbb18cdea
10
util.js
10
util.js
@ -5,11 +5,6 @@ const formats = Object.freeze({
|
||||
file_date: "YYYY-MM-DD HH:mm:ss z",
|
||||
id_date: "YYYYMMDD-HHmm" });
|
||||
|
||||
function getTimezone(ctx) {
|
||||
if (ctx.header['x-client-timezone'] !== undefined)
|
||||
return ctx.header['x-client-timezone'];
|
||||
}
|
||||
|
||||
function datetime(date, format=formats.post_date, timezone="UTC") {
|
||||
return moment.utc(date).tz(timezone).format(format);
|
||||
}
|
||||
@ -35,7 +30,10 @@ exports.getServiceByHost = (host, service="") => {
|
||||
}
|
||||
}
|
||||
|
||||
exports.getTimezone = getTimezone;
|
||||
exports.getTimezone = ctx => {
|
||||
if (ctx.header['x-client-timezone'] !== undefined)
|
||||
return ctx.header['x-client-timezone'];
|
||||
};
|
||||
exports.formats = formats;
|
||||
exports.datetime = datetime;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user