Skip to content

Commit 78b1596

Browse files
Get the timestamps to work (though the tests to fail)
1 parent ba459a0 commit 78b1596

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

cynthia_websites_mini_client/manifest.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
packages = [
55
{ name = "conversation", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "conversation", source = "hex", outer_checksum = "908B46F60444442785A495197D482558AD8B849C3714A38FAA1940358CC8CCCD" },
6-
{ name = "cynthia_websites_mini_shared", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib"], source = "local", path = "../cynthia_websites_mini_shared" },
6+
{ name = "cynthia_websites_mini_shared", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "plinth"], source = "local", path = "../cynthia_websites_mini_shared" },
77
{ name = "gleam_community_colour", version = "1.4.1", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "386CB9B01B33371538672EEA8A6375A0A0ADEF41F17C86DDCB81C92AD00DA610" },
88
{ name = "gleam_erlang", version = "0.33.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "A1D26B80F01901B59AABEE3475DD4C18D27D58FA5C897D922FCB9B099749C064" },
99
{ name = "gleam_http", version = "3.7.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "8A70D2F70BB7CFEB5DF048A2183FFBA91AF6D4CF5798504841744A16999E33D2" },
1010
{ name = "gleam_javascript", version = "0.13.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "F98328FCF573DA6F3A35D7F6CB3F9FF19FD5224CCBA9151FCBEAA0B983AF2F58" },
1111
{ name = "gleam_json", version = "2.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "C55C5C2B318533A8072D221C5E06E5A75711C129E420DD1CE463342106012E5D" },
12-
{ name = "gleam_otp", version = "0.16.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "FA0EB761339749B4E82D63016C6A18C4E6662DA05BAB6F1346F9AF2E679E301A" },
12+
{ name = "gleam_otp", version = "0.16.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "50DA1539FC8E8FA09924EB36A67A2BBB0AD6B27BCDED5A7EF627057CF69D035E" },
1313
{ name = "gleam_stdlib", version = "0.52.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "50703862DF26453B277688FFCDBE9DD4AC45B3BD9742C0B370DB62BC1629A07D" },
1414
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
1515
{ name = "lustre", version = "4.6.3", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "BDF833368F6C8F152F948D5B6A79866E9881CB80CB66C0685B3327E7DCBFB12F" },

cynthia_websites_mini_server/gleam.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ gleam_community_colour = ">= 1.4.1 and < 2.0.0"
1515
cynthia_websites_mini_shared = { path = "../cynthia_websites_mini_shared" }
1616
simplifile = ">= 2.2.0 and < 3.0.0"
1717
gleam_json = ">= 2.3.0 and < 3.0.0"
18+
question = ">= 1.0.0 and < 2.0.0"
1819

1920
[dev-dependencies]
2021
gleeunit = ">= 1.0.0 and < 2.0.0"

cynthia_websites_mini_server/manifest.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
packages = [
55
{ name = "bungibindies", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], otp_app = "bungibindies", source = "hex", outer_checksum = "9E470A3C1CC3057D603093BBCF4E94D7609660BE4005220514CA6280725D2AE6" },
66
{ name = "conversation", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "conversation", source = "hex", outer_checksum = "908B46F60444442785A495197D482558AD8B849C3714A38FAA1940358CC8CCCD" },
7-
{ name = "cynthia_websites_mini_shared", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib"], source = "local", path = "../cynthia_websites_mini_shared" },
7+
{ name = "cynthia_websites_mini_shared", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "plinth"], source = "local", path = "../cynthia_websites_mini_shared" },
88
{ name = "envoy", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "95FD059345AA982E89A0B6E2A3BF1CF43E17A7048DCD85B5B65D3B9E4E39D359" },
99
{ name = "filepath", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "67A6D15FB39EEB69DD31F8C145BB5A421790581BD6AA14B33D64D5A55DBD6587" },
1010
{ name = "gleam_community_colour", version = "1.4.1", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "386CB9B01B33371538672EEA8A6375A0A0ADEF41F17C86DDCB81C92AD00DA610" },
@@ -15,6 +15,7 @@ packages = [
1515
{ name = "gleamy_lights", version = "2.3.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_community_colour", "gleam_stdlib"], otp_app = "gleamy_lights", source = "hex", outer_checksum = "8A3D43BCA0D935F7CC787F4D0D1771F822B3366114C08B93CC8D00747618499A" },
1616
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
1717
{ name = "plinth", version = "0.5.6", build_tools = ["gleam"], requirements = ["conversation", "gleam_javascript", "gleam_json", "gleam_stdlib"], otp_app = "plinth", source = "hex", outer_checksum = "7A9BEAB98F4BC6859803D5ABCD0F3B4C3578A747F12BF32F9E234F8325F5F0E0" },
18+
{ name = "question", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "question", source = "hex", outer_checksum = "10C08C66570B3727FD39CCBB30F88B8648EA993CD85DF7F84EB6E5FD220E9758" },
1819
{ name = "simplifile", version = "2.2.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0DFABEF7DC7A9E2FF4BB27B108034E60C81BEBFCB7AB816B9E7E18ED4503ACD8" },
1920
]
2021

@@ -28,4 +29,5 @@ gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
2829
gleamy_lights = { version = ">= 2.3.0 and < 3.0.0" }
2930
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
3031
plinth = { version = ">= 0.5.6 and < 1.0.0" }
32+
question = { version = ">= 1.0.0 and < 2.0.0" }
3133
simplifile = { version = ">= 2.2.0 and < 3.0.0" }

cynthia_websites_mini_server/test/cynthia_websites_mini_server_test.gleam

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import gleeunit
22
import gleeunit/should
33

4+
// todo: Timestamp conversion test
5+
6+
import cynthia_websites_mini_shared/timestamps
7+
48
pub fn main() {
59
gleeunit.main()
610
}
@@ -10,3 +14,11 @@ pub fn hello_world_test() {
1014
1
1115
|> should.equal(1)
1216
}
17+
18+
// Test timestamp conversion
19+
pub fn timestamp_to_test() {
20+
let time = "2025-01-22T12:12:07+0000"
21+
let parsed = timestamps.parse(time)
22+
timestamps.create(parsed)
23+
|> should.equal(time)
24+
}

cynthia_websites_mini_shared/src/cynthia_websites_mini_shared/timestamps.gleam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import plinth/javascript/date
22

33
/// Converts a timestamp from the ISO 8601 date format (EG: 2025-01-22T12:12:07+0000)
44
/// To a JavaScript 'date' object, accessible through Plinth.
5-
@external(javascript, "./timestamps.mjs", "parse")
5+
@external(javascript, "./timestamps_ffi.mjs", "parse")
66
pub fn parse(timestamp: String) -> date.Date
77

88
/// Converts a JavaScript 'date' object, accessible through Plinth

cynthia_websites_mini_shared/src/cynthia_websites_mini_shared/timestamps.mjs renamed to cynthia_websites_mini_shared/src/cynthia_websites_mini_shared/timestamps_ffi.mjs

File renamed without changes.

0 commit comments

Comments
 (0)