| 48 | } |
| 49 | |
| 50 | timeActions() { |
| 51 | let time = new Date(); |
| 52 | this.frames++; |
| 53 | let ampm = time.getHours() >= 12 ? "PM" : "AM"; |
| 54 | let formattedMinutes = time.getMinutes() >= 10 ? time.getMinutes() : `0${time.getMinutes()}`; |
| 55 | let formattedHours = time.getHours() % 12 === 0 ? 12 : time.getHours() % 12; |
| 56 | let timeString = `${formattedHours}:${formattedMinutes} ${ampm}`; |
| 57 | return [ |
| 58 | new InsertAction("time|tag", "time", "tag", "time"), |
| 59 | new SetAction("time|year","time", "year", time.getFullYear()), |
| 60 | new SetAction("time|month","time", "month", time.getMonth()), |
| 61 | new SetAction("time|day","time", "day", time.getDate()), |
| 62 | new SetAction("time|hours","time", "hours", time.getHours() % 12), |
| 63 | new SetAction("time|hours-24","time", "hours-24", time.getHours()), |
| 64 | new SetAction("time|minutes","time", "minutes", time.getMinutes()), |
| 65 | new SetAction("time|time-string","time", "time-string", timeString), |
| 66 | new SetAction("time|seconds","time", "seconds", time.getSeconds()), |
| 67 | new SetAction("time|timestamp","time", "timestamp", time.getTime()), |
| 68 | new SetAction("time|frames","time", "frames", this.frames), |
| 69 | new SetAction("time|time","time", "ampm", ampm), |
| 70 | ]; |
| 71 | } |
| 72 | |
| 73 | run(evaluation: Evaluation) { |
| 74 | let self = this; |