33 lines
1.2 KiB
OCaml
33 lines
1.2 KiB
OCaml
open Pam.Datatypes
|
|
let test1 () =
|
|
let body = {|@alert: -12:38 10:02 +09:24
|
|
|
|
## Description
|
|
|
|
Specify a time format by writing the exact time of the alert, then adding zero or more '+' or '-'.
|
|
Examples, due date is 1/1/1970:
|
|
1. 12:38: you get the alert 1/1/1970 at 12:38
|
|
2. -12:38: you get the alert 31/12/1969 at 12:38
|
|
3. --12:38: you get the alert 30/12/1969 at 12:38
|
|
4. +12:38: you get the alert 2/1/1970 at 12:38 |}
|
|
in
|
|
let _a = ("https://salsa.lezzo.org/api/v1/repos/bparodi/Documenti/issues/25", "Casa", ("2024-04-20T23:59:59+02:00"), body) in
|
|
let m = MatrixRoom.make "test" in
|
|
let reminder = {url="example.org"; title= "example"; due_date= Some "2024-04-20T23:59:59+02:00"; body=body; matrix_target=m} in
|
|
let res = Pam.Issue_parser.to_datetime reminder in
|
|
match res with
|
|
| Ok None -> failwith "none"
|
|
| Error e -> failwith e
|
|
| Ok (Some ar) ->
|
|
let _ = ar
|
|
|> List.map (Ptime.to_rfc3339)|> List.iter print_endline in
|
|
let _ = Ptime_clock.now () |> Ptime.to_rfc3339 |> print_endline in
|
|
failwith "MAnca +2 offset";
|
|
failwith "MAnca giorni negativi o positive '+'/'-'"
|
|
|
|
|
|
|
|
|
|
let () =
|
|
let _ = test1 ()
|
|
in ()
|