2.3 KiB
2.3 KiB
Hints
General
- Review the functions available in the
NaiveDateTime
module, theDate
module, and theTime
module.
1. Parse the stored datetimes
- There is a built-in function that parses an ISO8601 datetime string and returns a
NaiveDateTime
struct.
2. Determine if a book was checked out before noon
- You can define a
Time
literal using the~T
sigil. - There is a built-in function that changes a
NaiveDateTime
struct to aTime
struct. - There is a built-in function that checks which one of two
Time
structs is bigger.
3. Calculate the return date
- A day has
24 * 60 * 60
seconds. - There is a built-in function that adds a given number of seconds to a
NaiveDateTime
struct. - There is a built-in function that changes a
NaiveDateTime
struct to aDate
struct.
4. Determine how late the return of the book was
- There is a built-in function that changes a
NaiveDateTime
struct to aDate
struct. - There is a built-in function that calculates the difference in days between two
Date
structs.
5. Determine if the book was returned on a Monday
- There is a built-in function that changes a
NaiveDateTime
struct to aDate
struct. - There is a built-in function that returns the day of week for a given
Date
struct.
6. Calculate the late fee
- Combine together all of the functions that you defined in previous steps.