rozetko
2 years ago
2 changed files with 3 additions and 15 deletions
@ -1,17 +1,5 @@ |
|||||||
import * as moment from 'moment-timezone'; |
import * as moment from 'moment-timezone'; |
||||||
|
|
||||||
export async function promisify(method: (...params: any[]) => Promise<any> | void, ...params: any[]) { |
|
||||||
return new Promise((resolve, reject) => { |
|
||||||
method(...params, (err, result) => { |
|
||||||
if(err) { |
|
||||||
reject(err); |
|
||||||
} else { |
|
||||||
resolve(result); |
|
||||||
} |
|
||||||
}) |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
export function toIsoString(msTimestamp: number, timeZone: string): string { |
export function toIsoString(msTimestamp: number, timeZone: string): string { |
||||||
return moment.tz(msTimestamp, timeZone).format('YYYY-MM-DD HH:mm:ssZ').replace(/:00$/, ''); |
return moment.tz(msTimestamp, timeZone).format('YYYY-MM-DD HH:mm:ssZ').replace(/:00$/, ''); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue