Date Lib
Javascript Library of date functions created to make life just a little easier when it comes to calling dates in a project.
Assignment elaborated here
Published npm package here
Challenge 1
Instantiate date string with parameters for year, month, date, hours, mins, secs, etc. Create a class that holds a Date object as a property and accepts and passes parameters to initialized Date objects.
Challenge 2
Provide readable values for Date elements using getters. Remember that the index starts at 0 when displaying correct dates.
Challenge 3
Create a format method that takes a "mask" string, which will contain formatting characters to display Date elements easier.
Character codes:
-
Y
- Year (2022) -
y
- Abbreviated Year (22) -
O
- Month (April) -
o
- Abbreviated Month (Apr) -
M
- Padded Month Date (04) -
m
- Month Date (4) -
D
- Day (Friday) -
d
- Abbreviated Day (Fri) -
T
- Padded Date (08) -
t
- Date (8) -
H
- Padded Hour (08) -
h
- Hour (8) -
I
- Padded Minute (08) -
i
- Minute (8) -
S
- Padded Seconds (08) -
s
- Seconds (8)
Challenge 4
Make a when() function that returns a readable description of when a date will occur.
example: 3 months from now.
Challenge 5
Document library by writing JS Doc string comments describing each method and output to repo or write it in README.md file.
Challenge 6
Write unit tests for all properties and methods in the date library.
Challenge 7
Publish to npm. include the following badges in README.md:
- npm version
- license
- size
- GitHub issues