UNPKG

1.8 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5
6/*!
7 * Copyright 2016 Amazon.com,
8 * Inc. or its affiliates. All Rights Reserved.
9 *
10 * Licensed under the Amazon Software License (the "License").
11 * You may not use this file except in compliance with the
12 * License. A copy of the License is located at
13 *
14 * http://aws.amazon.com/asl/
15 *
16 * or in the "license" file accompanying this file. This file is
17 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
18 * CONDITIONS OF ANY KIND, express or implied. See the License
19 * for the specific language governing permissions and
20 * limitations under the License.
21 */
22var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
23var weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
24/** @class */
25
26var DateHelper = /*#__PURE__*/function () {
27 function DateHelper() {}
28
29 var _proto = DateHelper.prototype;
30
31 /**
32 * @returns {string} The current time in "ddd MMM D HH:mm:ss UTC YYYY" format.
33 */
34 _proto.getNowString = function getNowString() {
35 var now = new Date();
36 var weekDay = weekNames[now.getUTCDay()];
37 var month = monthNames[now.getUTCMonth()];
38 var day = now.getUTCDate();
39 var hours = now.getUTCHours();
40
41 if (hours < 10) {
42 hours = "0" + hours;
43 }
44
45 var minutes = now.getUTCMinutes();
46
47 if (minutes < 10) {
48 minutes = "0" + minutes;
49 }
50
51 var seconds = now.getUTCSeconds();
52
53 if (seconds < 10) {
54 seconds = "0" + seconds;
55 }
56
57 var year = now.getUTCFullYear(); // ddd MMM D HH:mm:ss UTC YYYY
58
59 var dateNow = weekDay + " " + month + " " + day + " " + hours + ":" + minutes + ":" + seconds + " UTC " + year;
60 return dateNow;
61 };
62
63 return DateHelper;
64}();
65
66exports["default"] = DateHelper;
\No newline at end of file