Binding to <time>.datetime attribute in Dart


I’m tying to create a component which has a <time/> tag in it. And I’m trying to binding to its datetime attribute. Sample:

// component:

String isoFormat;

<!-- html template: -->

<time datetime="{{isoFormat}}">{{display}}</time>

But, I’m getting this compile-time error:

ParseErrorLevel.FATAL: Can’t bind to ‘datetime’ since it isn’t a known
native property or known directive. Please fix typo or add to
directives list.

Is there any fix for that? Or I should drop it? Thanks in advance.


Since datetime is a native HTML5 attribute, did you try prefixing it with attr.?


<time [attr.datetime]="isoFormat">{{display}}</time>

See here:

Answered By – Crazywater

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *