amazon-cognito-identity-js
Version:
Amazon Cognito Identity Provider JavaScript SDK
44 lines (40 loc) • 1.33 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
/** @class */
var DateHelper = exports["default"] = /*#__PURE__*/function () {
function DateHelper() {}
var _proto = DateHelper.prototype;
/**
* @returns {string} The current time in "ddd MMM D HH:mm:ss UTC YYYY" format.
*/
_proto.getNowString = function getNowString() {
var now = new Date();
var weekDay = weekNames[now.getUTCDay()];
var month = monthNames[now.getUTCMonth()];
var day = now.getUTCDate();
var hours = now.getUTCHours();
if (hours < 10) {
hours = "0" + hours;
}
var minutes = now.getUTCMinutes();
if (minutes < 10) {
minutes = "0" + minutes;
}
var seconds = now.getUTCSeconds();
if (seconds < 10) {
seconds = "0" + seconds;
}
var year = now.getUTCFullYear();
// ddd MMM D HH:mm:ss UTC YYYY
var dateNow = weekDay + " " + month + " " + day + " " + hours + ":" + minutes + ":" + seconds + " UTC " + year;
return dateNow;
};
return DateHelper;
}();
;