从 Rails 到 Flex 的日期/时间转换问题?
我收到以下错误: TypeError:错误#1034:类型强制失败:无法将“2010-01-02 23:28:17 UTC”转换为日期。
我正在使用 WebORB 在 Rails 和 Flex 之间传输数据。来自 Rails 的数据类型为:“ActiveSupport::TimeWithZone”。我正在尝试将其分配给 Flex“日期”数据类型。
我缺少什么?
I am getting the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert "2010-01-02 23:28:17 UTC" to Date.
I am using WebORB to transfer data between Rails and Flex. The data coming from Rails is of type: 'ActiveSupport::TimeWithZone'. I am trying to assign it to a Flex 'Date' data type.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自文档:http://www.adobe。 com/livedocs/flex/3/langref/Date.html#Date()
我认为在 Rails 中,您需要做的是调用
strftime
来格式化将发送到 Flex 的日期输出From the documentation: http://www.adobe.com/livedocs/flex/3/langref/Date.html#Date()
I think in Rails, what you need to do is calling
strftime
to format the date output that's going to be sent to Flex感谢您的帮助,但奇怪的是,事实并非如此。西卡丘,你的帮助确实让我走上了正轨。我不能简单地分配返回的结果——我必须将其输入构造函数。因此,我没有这样做,但它不起作用:
我这样做了,它有效:
Thanks for the help but, oddly, that wasn't it. Your help, Sikachu, did put me on the right track. I couldn't simply assign the returned result--I had to feed it into the constructor. So, instead of doing this, which didn't work:
I did this, which works: