CODE
Get-Current-Date
export function BTNgetDate_click(event) {
const today = new Date();
let currentDate = today.toLocaleDateString()
$w('#TXTwindow').text = currentDate
}
Get-Current-Time
export function BTNgetTime_click(event) {
const today = new Date();
let currentTime = today.toLocaleTimeString()
$w('#TXTwindow').text = currentTime
}
Set-Timer / Check-Alarm
export function BTNsetTimer_click(event) {
myTimer = $w('#input1').value
console.log(myTimer)
$w('#input2').value = myTimer
}
​
export function BTNcheckTime_click(event) {
const today = new Date();
let currentTime = today.toLocaleTimeString()
if (currentTime<=myTimer) {
console.log("NO-ALARM")
$w('#TXTwindow').text = "NO-ALARM"
} else {
console.log("ALARM")
$w('#TXTwindow').text = "ALARM"
}
}
Complete-Code
var myTimer
export function BTNgetDate_click(event) {
const today = new Date();
let currentDate = today.toLocaleDateString()
$w('#TXTwindow').text = currentDate
}
export function BTNgetTime_click(event) {
const today = new Date();
let currentTime = today.toLocaleTimeString()
$w('#TXTwindow').text = currentTime
}
export function BTNsetTimer_click(event) {
myTimer = $w('#input1').value
console.log(myTimer)
$w('#input2').value = myTimer
}
export function BTNcheckTime_click(event) {
const today = new Date();
let currentTime = today.toLocaleTimeString()
if (currentTime<=myTimer) {
console.log("NO-ALARM")
$w('#TXTwindow').text = "NO-ALARM"
} else {
console.log("ALARM")
$w('#TXTwindow').text = "ALARM"
}
}
​
export function BTNconsoleLog_click(event) {
const today = new Date();
console.log(today)
console.log("DATE = " + today.toLocaleDateString())
console.log(typeof today.toLocaleDateString())
console.log("TIME = " + today.toLocaleTimeString())
console.log(typeof today.toLocaleTimeString())
console.log("------------------")
}