Primeng 12 P-Calendar UTC问题
我对Primeng日历组件有问题。我需要在日历中从选定的值中删除UTC。选择日历组件中的日期,表单值为:
Wed Jun 01 2022 00:00:00 GMT+0200 (Ora legale dell’Europa centrale)
因此,当我调用通过此值的rest服务传递时,它会转换为:
"2022-05-31T22:00:00.000Z"
我知道这是与UTC相关的问题,但我找不到一种方法来删除UTC设置属性进入p-calendar。 有办法这样做吗?还是可以将所选值管理为指令? 我正在使用Primeng 12.2.16
I've a problem with PrimeNg Calendar component. I need to remove UTC from selected value in calendar. Selecting a date in the calendar component, the form value is:
Wed Jun 01 2022 00:00:00 GMT+0200 (Ora legale dell’Europa centrale)
so when i call a rest service passing this value, it is converted into:
"2022-05-31T22:00:00.000Z"
I know it's a problem related to UTC but I can't find a way to remove UTC setting attributes into p-calendar.
Is there a way to do this? Or it's possibile to manage the selected value into a directive?
I'm using PrimeNg 12.2.16
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对我来说,我做了一个指令和日期偏移校正的解决方案:
然后当我进行
value.toisostring()
时,它将给出一个日期,例如'2022-09-12T00:00.000:00.000 z'
。用表格测试。
OnSelect()
之类的输出不会更改其他功能,但您可以改进此代码。For me I made a solution with a directive and date offset correction:
And then when I do
value.toISOString()
It will give a date like'2022-09-12T00:00:00.000Z'
.Tested with forms. Outputs like
onSelect()
and some other functionality won't be changed but you can improve this code.