summaryrefslogtreecommitdiffstats
path: root/data_model/DataHelpers.gd
blob: 9e8d7cd0460df1f2eb582edaa29973c14787be9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class_name DataHelpers

static func dummy_data(data):
    return data

static func timeofday(time):
    var hour = time / 60
    var minute = time % 60
    var am = hour < 12
    hour = hour % 12
    if hour == 0:
        hour = 12
    var string = "%2d:%02d %s"
    return string % [hour, minute, "AM" if am else "PM"]

enum Frequency {DAILY, EVERY_OTHER_DAY, WEEKLY, BI_WEEKLY, MONTHLY, SIZE}
static func frequency(freq):
    match freq:
        Frequency.DAILY: return "Daily"
        Frequency.EVERY_OTHER_DAY: return "Every\nOther Day"
        Frequency.WEEKLY: return "Weekly"
        Frequency.BI_WEEKLY: return "Bi-Weekly"
        Frequency.MONTHLY: return "Monthly"
        _: return ""