使用 Scala 创建的 API 中的 proto 文件。我的代码在 JS 中,试图测试我的代码并得到以下错误:
AssertionError [ERR_ASSERTION]: invalid return value: post[0].lastPublishedDate: Date expected
试过但没有用:
lastPublishedDate: {seconds: <date>, nano: <date>}
,日期是文档中提到的日期 toISOString() ( https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto#L115 )lastPublishedDate: new Date().toISOString()
- 只需将
2019-02-18T14:18:45.346Z
(这就是我调用它时 API 似乎返回的内容)作为日期。
似乎没有什么对我有用。
我可以在网上找到的唯一其他参考是: https ://github.com/dcodeIO/protobuf.js/issues/437 ,它似乎也没有解决。
有没有人设法在 JS 中使用 google.protobuf.Timestamp ?