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,MAELvD,gBAAgBgB,MAAQ,MAG1BtB,SAAS2E,iBAAiB,SAAS,SAAUC,GAG3C,GAFAA,EAAEC,iBAGAtE,mBAAmBe,QAAUmD,eAAelB,WAC3C/C,cAAcc,QAAUmD,eAAe7F,IACxC,CACA,MAAMoH,EAAQ/G,SAASgH,WACrBvE,GAAOA,EAAI6B,WAAakB,eAAelB,WAEzCwB,QAAQC,IAAIgB,GAIZ/G,SAASiH,OAAOF,EAAO,GAGvBrG,aAAa6B,MAAM+C,QAAU,EAG/BhE,mBAAmBe,MAAQd,cAAcc,MAAQ,MAGnD,IAAI6E,QAAS,EACblG,QAAQ0E,iBAAiB,SAAS,SAAUC,GAC1CA,EAAEC,iBACFpD,iBAAiBgD,gBAAiB0B,QAClCA,QAAUA","sources":["script.js"],"sourcesContent":["'use strict';\n\n/////////////////////////////////////////////////\n/////////////////////////////////////////////////\n// BANKIST APP\n\n/////////////////////////////////////////////////\n// Data\n\n// DIFFERENT DATA! Contains movement dates, currency and locale\n\nconst account1 = {\n owner: 'Jonas Schmedtmann',\n movements: [200, 455.23, -306.5, 25000, -642.21, -133.9, 79.97, 1300],\n interestRate: 1.2, // %\n pin: 1111,\n\n movementsDates: [\n '2019-11-18T21:31:17.178Z',\n '2019-12-23T07:42:02.383Z',\n '2020-01-28T09:15:04.904Z',\n '2020-04-01T10:17:24.185Z',\n '2020-05-08T14:11:59.604Z',\n '2022-04-27T14:43:26.374Z',\n '2022-04-29T18:49:59.371Z',\n '2022-05-03T12:01:20.894Z',\n ],\n currency: 'EUR',\n locale: 'pt-PT', // de-DE\n};\n\nconst account2 = {\n owner: 'Jessica Davis',\n movements: [5000, 3400, -150, -790, -3210, -1000, 8500, -30],\n interestRate: 1.5,\n pin: 2222,\n\n movementsDates: [\n '2019-11-01T13:15:33.035Z',\n '2019-11-30T09:48:16.867Z',\n '2019-12-25T06:04:23.907Z',\n '2020-01-25T14:18:46.235Z',\n '2020-02-05T16:33:06.386Z',\n '2020-04-27T14:43:26.374Z',\n '2020-04-29T18:49:59.371Z',\n '2020-05-03T12:01:20.894Z',\n ],\n currency: 'USD',\n locale: 'en-US',\n};\n\nconst accounts = [account1, account2];\n\n/////////////////////////////////////////////////\n// Elements\nconst labelWelcome = document.querySelector('.welcome');\nconst labelDate = document.querySelector('.date');\nconst labelBalance = document.querySelector('.balance__value');\nconst labelSumIn = document.querySelector('.summary__value--in');\nconst labelSumOut = document.querySelector('.summary__value--out');\nconst labelSumInterest = document.querySelector('.summary__value--interest');\nconst labelTimer = document.querySelector('.timer');\n\nconst containerApp = document.querySelector('.app');\nconst containerMovements = document.querySelector('.movements');\n\nconst btnLogin = document.querySelector('.login__btn');\nconst btnTransfer = document.querySelector('.form__btn--transfer');\nconst btnLoan = document.querySelector('.form__btn--loan');\nconst btnClose = document.querySelector('.form__btn--close');\nconst btnSort = document.querySelector('.btn--sort');\n\nconst inputLoginUsername = document.querySelector('.login__input--user');\nconst inputLoginPin = document.querySelector('.login__input--pin');\nconst inputTransferTo = document.querySelector('.form__input--to');\nconst inputTransferAmount = document.querySelector('.form__input--amount');\nconst inputLoanAmount = document.querySelector('.form__input--loan-amount');\nconst inputCloseUsername = document.querySelector('.form__input--user');\nconst inputClosePin = document.querySelector('.form__input--pin');\n\n/////////////////////////////////////////////////\n// Functions\n\nconst formatMovementDate = function (date, locale) {\n const calcDaysPassed = (date1, date2) =>\n Math.round(Math.abs(date2 - date1) / (1000 * 60 * 60 * 24));\n\n const daysPassed = calcDaysPassed(new Date(), date);\n //console.log(daysPassed);\n\n if (daysPassed === 0) return `Today`;\n if (daysPassed === 1) return `Yesterday`;\n if (daysPassed <= 7) return `${daysPassed} days ago`;\n\n // const day = `${date.getDate()}`.padStart(2, '0');\n // const month = `${date.getMonth() + 1}`.padStart(2, '0');\n // const year = date.getFullYear();\n // return `${day}/${month}/${year}`;\n return new Intl.DateTimeFormat(locale).format(date);\n};\n\nconst formatCur = function (value, locale, currency) {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currency,\n }).format(value);\n};\n\nconst displayMovements = function (acc, sort = false) {\n containerMovements.innerHTML = '';\n\n const movs = sort\n ? acc.movements.slice().sort((a, b) => a - b)\n : acc.movements;\n\n movs.forEach(function (mov, i) {\n const type = mov > 0 ? 'deposit' : 'withdrawal';\n\n const date = new Date(acc.movementsDates[i]);\n const displayDate = formatMovementDate(date, acc.locale);\n const formattedMov = formatCur(mov, acc.locale, acc.currency);\n\n const html = `\n