Tạo tập tin ics javascript

Ví dụ này giới thiệu cách xuất các sự kiện Trình lập lịch biểu sang lịch [. ics], cũng như cách nhập các sự kiện từ một. ics [được tải xuống từ bất kỳ lịch nào như Google hoặc Outlook] vào Trình lập lịch biểu của chúng tôi

Thêm chi tiết

Trong ví dụ này, các sự kiện Trình lập lịch biểu có thể được xuất sang lịch [. ics] bằng cách sử dụng phương thức công khai exportToICalWiki. Theo mặc định, lịch được xuất với tên tệp Lịch. ics. Để thay đổi tên tệp này khi xuất, hãy chuyển giá trị chuỗi tùy chỉnh dưới dạng tên tệp để tải xuống tệp có tên được cung cấp này. Các sự kiện từ lịch bên ngoài cũng có thể được nhập vào Trình lập lịch biểu bằng cách sử dụng phương thức importICalWiki. Phương thức này chấp nhận đối tượng blob của một. ics được nhập làm đối số bắt buộc. Chèn mô-đun Để bắt đầu sử dụng chức năng xuất và nhập ICS trong Trình lập lịch biểu, bạn cần nhập các mô-đun ICalendarExport và ICalendarImport từ gói @syncfusion/ej2-schedule, sau đó đưa chúng vào bằng cách sử dụng Lịch trình. Phương thức Tiêm [ICalWikiExport, ICalWikiImport]

Người dùng-335504541 đã đăng

Xin chào jeffcarter,

Tôi nghĩ bạn có thể thử sử dụng ics. js và FileSaver. js

Ví dụ

    
     
    


    
        

tài liệu tham khảo

https. //github. com/nwcell/ics. js

https. //github. com/eligrey/FileSaver. js

Trân trọng,

Billy

Tạo chuỗi VCALENDAR tuân thủ iCal với một VEVENT. Nếu hàm gọi lại không được cung cấp, trả về một đối tượng có dạng

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
2, trong đó
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
3 chứa chuỗi tuân thủ iCal nếu không có lỗi. Nếu một cuộc gọi lại được cung cấp, hãy trả về một cuộc gọi lại kiểu Node

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
4

Đối tượng chữ chứa thông tin sự kiện. Chỉ thuộc tính

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
5 là bắt buộc. Các thuộc tính sau được chấp nhận

Mô tả thuộc tínhExamplestartBắt buộc. Ngày và giờ mà sự kiện bắt đầu.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
6 [05/01/2000]startInputTypeType của dữ liệu ngày/giờ trong
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
5.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
8 [mặc định]. dữ liệu đã truyền theo giờ địa phương.
______19. dữ liệu đã truyền là UTCstartOutputTypeFormat của ngày/giờ bắt đầu ở đầu ra.
______19 [mặc định]. ngày bắt đầu sẽ được gửi ở định dạng UTC.
______18. ngày bắt đầu sẽ được gửi dưới dạng "thả nổi" [mẫu số 1 trong RFC 5545]thời gian kết thúc khi sự kiện kết thúc. Bắt buộc phải có
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
12 hoặc
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
13, nhưng không phải cả hai.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
14 [ngày 5 tháng 1 năm 2000 lúc 1 giờ chiều]endInputTypeType của dữ liệu ngày/giờ trong
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
12.
____18. dữ liệu đã truyền theo giờ địa phương.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
9. dữ liệu đã truyền là UTC.
Giá trị mặc định là giá trị của
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
18endOutputTypeFormat của ngày/giờ bắt đầu trong đầu ra.
______19. ngày bắt đầu sẽ được gửi ở định dạng UTC.
____18. ngày bắt đầu sẽ được gửi dưới dạng "thả nổi" [mẫu số 1 trong RFC 5545].
Giá trị mặc định là
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
01duration Sự kiện kéo dài bao lâu. Đối tượng theo nghĩa đen có dạng
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
02 Bắt buộc phải có
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
12 hoặc
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
13, nhưng không phải cả hai.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
05 [1 giờ 45 phút]tiêu đềTiêu đề của sự kiện.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
06descriptionMô tả sự kiện.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
07địa điểmĐịa điểm dự định
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
08geoTọa độ địa lý [vĩ độ/vĩ độ]
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
09urlURL được liên kết với sự kiện
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
90statusBa trạng thái được cho phép.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
91,
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
92,
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
93_______292người tổ chứcNgười tổ chức sự kiện
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
95người tham dựNhững người được mời tham gia sự kiện
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
96danh mụcCác danh mục liên quan đến sự kiện
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
97báo độngCảnh báo có thể được đặt để kích hoạt trước, trong hoặc sau sự kiện. Các thuộc tính
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
98 sau hoạt động trên Mac OS. Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sousumi, Submarine, Tink
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
99 HOẶC
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
90 HOẶC
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
91 HOẶC
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
92productIdProduct đã tạo ics, trường
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
93
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
94uidId duy nhất chung cho sự kiện, được tạo theo mặc định với
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
95. Cảnh báo. Giá trị này phải là duy nhất trên toàn cầu. Khuyến nghị rằng nó tuân theo RFC 822 addr-spec [i. e.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
96]. Bao gồm một nửa
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
97 là một cách tốt để đảm bảo tính duy nhất.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
98method Thuộc tính này xác định phương thức đối tượng iCalendar được liên kết với đối tượng lịch. Khi được sử dụng trong thực thể thông báo MIME, giá trị của thuộc tính này PHẢI giống với giá trị tham số "phương thức" của Kiểu nội dung. Nếu thuộc tính "METHOD" hoặc tham số "phương thức" Kiểu nội dung được chỉ định, thì thuộc tính kia cũng PHẢI được chỉ định.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
99recurrenceRuleMột quy tắc lặp lại, thường được gọi là RRULE, xác định mẫu hoặc quy tắc lặp lại cho việc cần làm, mục nhật ký và sự kiện. Nếu được chỉ định, RRULE có thể được sử dụng để tính toán tập hợp lặp lại [tập hợp đầy đủ các trường hợp lặp lại trong thành phần lịch]. Bạn có thể sử dụng trình tạo như thế này một
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
90sequenceĐể gửi bản cập nhật cho một sự kiện [có cùng uid], hãy xác định số thứ tự sửa đổi.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
91busyStatusĐược sử dụng để chỉ định trạng thái bận cho các ứng dụng của Microsoft, như Outlook. Xem thông số kỹ thuật của Microsoft.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
92 OR
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
93 OR
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
94' OR
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
95classification Thuộc tính này xác định phân loại truy cập cho một thành phần lịch. Xem thông số iCalender.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
96 HOẶC
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
97 HOẶC
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
98' HOẶC bất kỳ chuỗi không chuẩn nào được tạoNgày-thời gian đại diện cho ngày tạo sự kiện. Cung cấp ngày-giờ theo UTC[2000, 1, 5, 10, 0] [05/01/2000 GMT +00. 00]lastModifiedDate-time biểu thị ngày khi sự kiện được sửa đổi lần cuối. Cung cấp ngày-giờ theo UTC[2000, 1, 5, 10, 0] [05/01/2000 GMT +00. 00]calNameChỉ định tên lịch [không phải sự kiện]. Được sử dụng bởi Apple iCal và Microsoft Outlook; . Thẻ DESCRIPTION tiêu chuẩn phải chứa phiên bản không phải HTML.
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
90

Để tạo sự kiện cả ngày, chỉ chuyển ba giá trị [

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
91,
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
92 và
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
93] cho thuộc tính
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
5 và
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
12. Ngày của tài sản
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
12 phải là ngày sau sự kiện cả ngày của bạn. Ví dụ: để tạo sự kiện cả ngày diễn ra vào ngày 15 tháng 10 năm 2018

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
9

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
97

Không bắt buộc. gọi lại kiểu nút

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
9

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
98

Tạo chuỗi VCALENDAR tuân thủ iCal với nhiều VEVENTS

Nếu một cuộc gọi lại không được cung cấp, trả về một đối tượng có dạng

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
2, trong đó giá trị là một chuỗi văn bản tuân thủ iCal nếu
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
10 là
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
11

Nếu một cuộc gọi lại được cung cấp, hãy trả về một cuộc gọi lại kiểu Node

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
12

Mảng của

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
4 đối tượng [như được mô tả trong
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
14]

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
97

Không bắt buộc. gọi lại kiểu nút

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
9

Phát triển, xây dựng

Chạy thử nghiệm mocha và theo dõi các thay đổi

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
9

Chạy thử nghiệm một lần và thoát

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
1

Xây dựng dự án, biên dịch tất cả các tệp ES6 trong thư mục

const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
16 thành vanilla JavaScript trong thư mục
const { writeFileSync } = require['fs']
const ics = require['ics']

ics.createEvent[{
  title: 'Dinner',
  description: 'Nightly thing I do',
  busyStatus: 'FREE',
  start: [2018, 1, 15, 6, 30],
  duration: { minutes: 50 }
}, [error, value] => {
  if [error] {
    console.log[error]
  }

  writeFileSync[`${__dirname}/event.ics`, value]
}]
17

Chủ Đề