@@ -156,6 +156,7 @@ defmodule Calendar.ISO do
156
156
@ type minute :: 0 .. 59
157
157
@ type second :: 0 .. 59
158
158
@ type weekday :: :monday | :tuesday | :wednesday | :thursday | :friday | :saturday | :sunday
159
+ @ type utc_offset :: integer
159
160
160
161
@ typedoc """
161
162
Microseconds with stored precision.
@@ -262,6 +263,9 @@ defmodule Calendar.ISO do
262
263
"""
263
264
@ doc since: "1.10.0"
264
265
@ impl true
266
+ @ callback parse_time ( String . t ( ) ) ::
267
+ { :ok , { hour , minute , second , microsecond } }
268
+ | { :error , atom }
265
269
def parse_time ( string ) when is_binary ( string ) ,
266
270
do: parse_time ( string , :extended )
267
271
@@ -336,6 +340,9 @@ defmodule Calendar.ISO do
336
340
"""
337
341
@ doc since: "1.10.0"
338
342
@ impl true
343
+ @ spec parse_date ( String . t ( ) ) ::
344
+ { :ok , { year , month , day } }
345
+ | { :error , atom }
339
346
def parse_date ( string ) when is_binary ( string ) ,
340
347
do: parse_date ( string , :extended )
341
348
@@ -412,6 +419,9 @@ defmodule Calendar.ISO do
412
419
"""
413
420
@ doc since: "1.10.0"
414
421
@ impl true
422
+ @ spec parse_naive_datetime ( String . t ( ) ) ::
423
+ { :ok , { year , month , day , hour , minute , second , microsecond } }
424
+ | { :error , atom }
415
425
def parse_naive_datetime ( string ) when is_binary ( string ) ,
416
426
do: parse_naive_datetime ( string , :extended )
417
427
@@ -507,6 +517,9 @@ defmodule Calendar.ISO do
507
517
"""
508
518
@ doc since: "1.10.0"
509
519
@ impl true
520
+ @ spec parse_utc_datetime ( String . t ( ) ) ::
521
+ { :ok , { year , month , day , hour , minute , second , microsecond } , utc_offset }
522
+ | { :error , atom }
510
523
def parse_utc_datetime ( string ) when is_binary ( string ) ,
511
524
do: parse_utc_datetime ( string , :extended )
512
525
0 commit comments