This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numberInWord = (amount) => { | |
const units = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine']; | |
const teens = ['', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']; | |
const tens = ['', 'Ten', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']; | |
const thousands = ['', 'Thousand', 'Million', 'Billion', 'Trillion']; // Extend as needed | |
function convertThreeDigits(num) { | |
const numStr = num.toString(); | |
const [a, b, c] = numStr.padStart(3, '0').split('').map(Number); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ISO time to YYYYMMDD formate using JavaScript | |
const YYYYMMDDFormat = (ISOdate, symbol = '-') => { | |
symbol = symbol ? symbol : '' | |
const year = ISOdate.getFullYear(); | |
const month = String(ISOdate.getMonth() + 1).padStart(2, '0'); | |
const day = String(ISOdate.getDate()).padStart(2, '0'); | |
return `${year}${symbol}${month}${symbol}${day}`; | |
} |