time-convertor-ts

Convert time across timezones (typescript)
git clone http://git.hanabi.in/repos/time-convertor-ts.git
Log | Files | Refs | README | LICENSE

commit 453836c9c943a42a64f20cb3c14d3ebc353d9c8b
parent eb0b1dc1dffb0d1fcf33bcfece22dc90dd738078
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Mon, 25 May 2020 06:33:44 +0530

more util functions

Diffstat:
Msrc/utils/index.ts | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/utils/index.ts b/src/utils/index.ts @@ -8,16 +8,27 @@ function friendlyStr(str: string): string { return str.replace(/_/g, ' '); } +/** + * @description Convert a string like `foo bar baz` to `foo_bar_baz` + * @param {string} str + */ +function unfriendlyStr(str: string): string { + return str.replace(/ /g, '_'); +} + export { - friendlyStr + friendlyStr, + unfriendlyStr }; const DEFAULT_TZ = 'UTC'; const localTimezone = moment.tz.guess(); +const timezoneList = moment.tz.names().sort(); const YEAR = new Date().getFullYear(); export { DEFAULT_TZ, localTimezone, + timezoneList, YEAR }; \ No newline at end of file