简体   繁体   English

无效的 ICS 文件并将时间添加到 Javascript 中的现有时间戳

[英]Invalid ICS file and adding time to existing timestamp in Javascript

It's my first time working with ICS files and I'm having trouble getting it to work:这是我第一次使用 ICS 文件,但我无法让它工作:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//test.com//NONSGML v1.0//EN
BEGIN:VEVENT 
UID:test@test.com
ATTENDEE;CN=My Self ;RSVP=FALSE
DTSTAMP:TZID=Australia/Sydney:19700101T100000
DTSTART:19700101T100000 
DTEND:19700101T100000
LOCATION:Online
SUMMARY:Test Title 10.0
DESCRIPTION:-
END:VEVENT
END:VCALENDAR

Not sure if this matters but this is how I've formatted it in Javascript:不确定这是否重要,但这就是我在 Javascript 中对其进行格式化的方式:

var icsFile = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//test.com//NONSGML v1.0//EN\nBEGIN:VEVENT \nUID:test@test.com\nATTENDEE;CN=My Self ;RSVP=FALSE\nDTSTAMP:"+ dtstamp +"\nDTSTART:" + start + " \nDTEND:" + start + "\nLOCATION:" + location + "\nSUMMARY:" + summary + "\nDESCRIPTION:" + description + "\nEND:VEVENT\nEND:VCALENDAR";

When I run it in the ics validator: https://icalendar.org/validator.html I get:当我在 ics 验证器中运行它时: https://icalendar.org/validator.html我得到:

Error
Invalid DTSTAMP value, must be a valid date-time value near line # 4
Reference: 3.3.5. Date-Time

Question 1问题 1

When I check DTSTAMP, it's correct based on Form#3: https://icalendar.org/iCalendar-RFC-5545/3-3-5-date-time.html当我检查 DTSTAMP 时,根据 Form#3 是正确的: https://icalendar.org/iCalendar-RFC-5545/3-3-5-date-time.html

Question 2问题2

How do I go about adding 3 hours into the DTEND timestamp in Javascript?我如何 go 关于在 Javascript 的DTEND时间戳中添加 3 小时?

Thanks!谢谢!

To fix the validation error, you need a semicolon after DTSTAMP instead of a colon:要修复验证错误,您需要在 DTSTAMP 后使用分号而不是冒号:

DTSTAMP;TZID=Australia/Sydney:19700101T100000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM