From 5ab314b42a151d45eacbf6287b25a6fd96258e83 Mon Sep 17 00:00:00 2001 From: David Dooling Date: Fri, 29 Mar 2019 08:18:18 -0500 Subject: [PATCH] Default formateDate to UTC --- lib/api-helper/misc/dateFormat.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/api-helper/misc/dateFormat.ts b/lib/api-helper/misc/dateFormat.ts index 9a72e64c3..3c5fe62fc 100644 --- a/lib/api-helper/misc/dateFormat.ts +++ b/lib/api-helper/misc/dateFormat.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2018 Atomist, Inc. + * Copyright © 2019 Atomist, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,15 @@ import * as df from "dateformat"; /** * Format the date with provided format. - * Defaults to formatting the current date with 'yyyymmddHHMMss' format. - * @param date - * @param format + * Defaults to formatting the current UTC date with 'yyyymmddHHMMss' format. + * + * @param date Date object to format + * @param format dateformat compatible format + * @param utc if true, use UTC time, otherwise use local time zone + * @return properly formatted date string */ export function formatDate(date: Date = new Date(), - format: string = "yyyymmddHHMMss"): string { - return df(date, format); + format: string = "yyyymmddHHMMss", + utc: boolean = true): string { + return df(date, format, utc); }