This fix is needed for IDEs to not complain about type mismatch, e.g. in cases such as
{{ item.modifiedDate | timeAgo }}
in case modified date is a number.
It works in practice because Date has a constructor that accepts number (milliseconds time stamp), but some IDEAs will complain about the pipe accepting only strings where the attribute is a number.
note: the ? condition seems redundant, but needed for typescript type guard to work. otherwise (at least in TS 2.7.2) it doesn't know to pick the right Date constructor based on the type of value
This fix is needed for IDEs to not complain about type mismatch, e.g. in cases such as
{{ item.modifiedDate | timeAgo }}
in case modified date is a number.
It works in practice because Date has a constructor that accepts number (milliseconds time stamp), but some IDEAs will complain about the pipe accepting only strings where the attribute is a number.
note: the ? condition seems redundant, but needed for typescript type guard to work. otherwise (at least in TS 2.7.2) it doesn't know to pick the right Date constructor based on the type of value