Trying to code a data field that will display different things depending on whether the current time is within a predefined interval each day.
For example, "Lunch" if it's between 1:00 pm and 2:00 pm, local time.
Couldn't find a preexisting thing that did that, so I figured I'd start from converting a string with a time (so that it's easier for me to enter later) to a Moment for that time today.
public function splitTime( timeString as Lang.String) as Time.Moment {
var sep = timeString.find(":");
var hour = timeString.substring(0, sep).toNumber();
var min = timeString.substring(sep + 1, null).toNumber();
return Gregorian.moment( {:hour => hour, :minute => min} );
}
Problem is that gives me the time I entered in UTC.
How would I take a local time (like 13:00) and get a moment that represents that time, today, in the local timezone?