2.3 KiB
2.3 KiB
Hints
General
- Review the functions available in the
NaiveDateTimemodule, theDatemodule, and theTimemodule.
1. Parse the stored datetimes
- There is a built-in function that parses an ISO8601 datetime string and returns a
NaiveDateTimestruct.
2. Determine if a book was checked out before noon
- You can define a
Timeliteral using the~Tsigil. - There is a built-in function that changes a
NaiveDateTimestruct to aTimestruct. - There is a built-in function that checks which one of two
Timestructs is bigger.
3. Calculate the return date
- A day has
24 * 60 * 60seconds. - There is a built-in function that adds a given number of seconds to a
NaiveDateTimestruct. - There is a built-in function that changes a
NaiveDateTimestruct to aDatestruct.
4. Determine how late the return of the book was
- There is a built-in function that changes a
NaiveDateTimestruct to aDatestruct. - There is a built-in function that calculates the difference in days between two
Datestructs.
5. Determine if the book was returned on a Monday
- There is a built-in function that changes a
NaiveDateTimestruct to aDatestruct. - There is a built-in function that returns the day of week for a given
Datestruct.
6. Calculate the late fee
- Combine together all of the functions that you defined in previous steps.