This commit is contained in:
Divlo 2020-01-20 22:02:21 +01:00
commit adf7c80c87
3 changed files with 8 additions and 6 deletions

View File

@ -36,10 +36,10 @@ function calculateAge(birthDateEntered) {
const isValidDateFunction = isValidDate(birthDateDay + '/' + birthDateMonth + '/' + birthDateYear, currentDateObject.showDateTimeValue); const isValidDateFunction = isValidDate(birthDateDay + '/' + birthDateMonth + '/' + birthDateYear, currentDateObject.showDateTimeValue);
// Vérifie si la valeur entrée correspond à une date de naissance valide // Vérifie si la valeur entrée correspond à une date de naissance valide
if(isValidDateFunction === true && !isNaN(ageDays)) { if(isValidDateFunction && !isNaN(ageDays)) {
ageYears = formatNumberResult(ageYears); ageYears = formatNumberResult(ageYears);
// Si c'est ton anniversaire aujourd'hui // Si c'est ton anniversaire aujourd'hui
if(birthDateDay === day && parseInt(birthDateMonth) === month) { if(birthDateDay === day && birthDateMonth === month) {
return 'Vous avez ' + ageYears + ' ans. Joyeux Anniversaire! 🥳'; return 'Vous avez ' + ageYears + ' ans. Joyeux Anniversaire! 🥳';
} }
else { else {

View File

@ -1,3 +1,5 @@
import { formatNumberResult } from '../fonctions_annexes/formatNumberResult_Function.js';
// Convertis des nombres de différentes bases et convertis en UTF-8. (source : http://jsfiddle.net/47zwb41o) // Convertis des nombres de différentes bases et convertis en UTF-8. (source : http://jsfiddle.net/47zwb41o)
/** /**
* @function decimalToBinary * @function decimalToBinary

View File

@ -7,14 +7,14 @@
* @example convertTemperature(23, '°C') 23 °C = 73.4 °F * @example convertTemperature(23, '°C') 23 °C = 73.4 °F
*/ */
function convertTemperature(degree, unit) { function convertTemperature(degree, unit) {
let temperatureValue = 0;
if (unit === "°C") { if (unit === "°C") {
const temperatureValue = ((degree * 9/5) + 32) + " °F"; temperatureValue = (((degree * 9/5) + 32) + " °F");
return degree + " " + unit + " = " + temperatureValue;
} }
else if (unit === "°F") { else if (unit === "°F") {
const temperatureValue = (degree - 32) * 5/9 + " °C"; temperatureValue = ((degree - 32) * 5/9 + " °C");
return degree + " " + unit + " = " + temperatureValue;
} }
return `${degree} ${unit} = ${temperatureValue}`;
} }
/* Exports */ /* Exports */