how to add time_grants to metrics yml files

Hi All,
currently is researching dbt sematic feature, but saw below two format to create the metrics. but seems second one always returns errors. wondering , is second version format is out of date? when use first type, how can we add time_grains attribtue to the yml? tried to add time_grants, but return error. if not add that attribute, when tried to run query against metrics, will get The metric xxxx does not have the provided time grain day defined in the metric definition. Anyone can help on this? what is the correct format for yml when using metrics? what is the standard query against the metrics? thanks
select * from {{metrics.calculate(