使用luxon的反应性午餐时间格式
我正在尝试用luxonjs替换Momentjs,该luxonjs用反应性形式的Mat-datepicker使用,最初我使用ISO格式加载了datepicker字段
'2022-05-10T10:34:31.311-04:00'
,我在Luxon格式下使用该值来保存值
dateTime.fromiso( this.form?.get('date')?value ).toisodate();
datetime.fromiso(this.form?get('date')?value) .plus({day:1}) .toisodate();
当我选择其他日期时,日期格式与我的原始格式不同
太阳5月1日2022 00:00:00 GMT-0400(东部日光时间)
如何使用Luxon将此格式更改为ISO
I'm trying to replace momentjs with luxonjs which is used in mat-datepicker of a reactive form, initially I'm loading the datepicker field with ISO format
'2022-05-10T10:34:31.311-04:00'
for which I used below luxon formatting to save the values
DateTime.fromISO(
this.form?.get('date')?.value
).toISODate();DateTime.fromISO(this.form?.get('date')?.value)
.plus({ day: 1 })
.toISODate();
When I select different date, the date format is different from my original
Sun May 01 2022 00:00:00 GMT-0400 (Eastern Daylight Time)
How to change this format to ISO using luxon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过使用Angular DatePipe将反应性形式日期值转换为ISO格式,通过解决方法解决了这个问题
I solved this issue with a workaround by converting the reactive form date value to ISO format using angular DatePipe