Groovy web console

subscribe to the feed Subscribe
to this


Published 2 months ago by asdasd with tags asdasd
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
Integer diff = -3 // when to send the notification? 3 days before shift's start timeDate now = new Date() // today
Date startTime = now + 4 // if you change 4 to 3 notification will be sent

// Sends the notification only if the difference is exactly what we expect.
// It will send always at the same time 3 days before shift start. If the
// difference is 2 days no notification will be sent.
if (now - startTime == diff) {
    println 'notification sent'
} else {
    println 'notification not sent'