月份名称序列化本地特定
根据 Coldfusion 文档,SerializeJSON 将日期转换为可由 JavaScript Date 对象轻松解析的字符串。 我刚刚序列化了一个查询,JavaScript 无法解析日期列,因为月份名称是本地特定的序列化返回 Mai,JavaScript 无法理解这一点。 Javascript 仅接受英文月份名称。我现在是否需要像刚才那样将本地特定月份名称手动替换为英文翻译才能轻松将字符串解析为 JavaScript Date 对象?
最好的, 伯恩哈德
according to the coldfusion docs SerializeJSON converts Dates to strings which can easily be parsed by JavaScript Date objects.
I just serialized a query and JavaScript could not parse the Date columns because the name of the month was serialized local specfic returning Mai, what is not understood by JavaScript. Javascript only accepts english month names. Do I now - as I just did - have to replace the local specific month name manually with it's english translation to easily parse the string to a JavaScript Date object?
Best,
Bernhard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(3)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
您可以尝试在服务器上处理此问题,方法是使用
setLocale('en_us')
在序列化时强制查询英语版本 - 不太理想,但它可能会完成工作。我认为这可以根据请求设置。请参阅此处的信息:http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fa3.html希望有所帮助。
You could try and deal with this on the server by using
setLocale('en_us')
to force English language versions of your query when serialised - not ideal but it might get the job done. I think this can be set per request. See info here: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fa3.htmlHope that helps.