File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -513,7 +513,25 @@ pipeline:
513
513
filters :
514
514
- name : lua
515
515
match : ' *'
516
- script : custom_datetime_format.lua
516
+ code : |
517
+ function convert_to_utc(tag, timestamp, record)
518
+ local date_time = record["pub_date"]
519
+ local new_record = record
520
+ if date_time then
521
+ if string.find(date_time, ",") then
522
+ local pattern = "(%a+, %d+ %a+ %d+ %d+:%d+:%d+) ([+-]%d%d%d%d)"
523
+ local date_part, zone_part = date_time:match(pattern)
524
+ if date_part and zone_part then
525
+ local command = string.format("date -u -d '%s %s' +%%Y-%%m-%%dT%%H:%%M:%%SZ", date_part, zone_part)
526
+ local handle = io.popen(command)
527
+ local result = handle:read("*a")
528
+ handle:close()
529
+ new_record["pub_date"] = result:match("%S+")
530
+ end
531
+ end
532
+ end
533
+ return 1, timestamp, new_record
534
+ end
517
535
call : convert_to_utc
518
536
519
537
outputs :
You can’t perform that action at this time.
0 commit comments