UNPKG

ggez-banking-sdk

Version:

A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.

23 lines (22 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenerateSourceID = GenerateSourceID; function GenerateSourceID() { const now = new Date(); // Helper function to format numbers as two digits const pad = (number) => String(number).padStart(2, "0"); // Helper function to format milliseconds as three digits const padMilliseconds = (number) => String(number).padStart(3, "0"); // Format date and time components const day = pad(now.getDate()); const month = pad(now.getMonth() + 1); // Months are zero-based const year = now.getFullYear(); const hours = pad(now.getHours()); const minutes = pad(now.getMinutes()); const seconds = pad(now.getSeconds()); const milliseconds = padMilliseconds(now.getMilliseconds()); const timestamp = `${day}${month}${year}.${hours}${minutes}${seconds}.${milliseconds}`; const userId = localStorage.getItem("user_id") ?? "0"; const source_id = `U.${userId}.${timestamp}`; return source_id; }