extends HBoxContainer

export var use_12_hours := true setget set_use_12_hours
export(Resource) var moment = Moment.new() setget set_moment


onready var hour = $hour
onready var minute = $minute
onready var am_pm := $VBoxContainer/am_pm

func set_moment(new_moment:Moment):
	moment = new_moment
	_update()

func set_use_12_hours(new_value:bool):
	use_12_hours = new_value
	_update()

func _update():
	minute.text = moment.padded_minute()
	am_pm.visible = use_12_hours
	am_pm.text = moment.am_pm()
	if use_12_hours:
		hour.text = moment.padded_hour_12()
	else:
		hour.text = moment.padded_hour()
