-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdates.rb
61 lines (49 loc) · 1.21 KB
/
dates.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Returns the nth month in words
#
# month(1) #=> 'January'
# month(2) #=> 'February'
# month(13) #=> ''
#
def month(n)
end
# Returns the last digit of a whole number
#
# last_digit(5) #=> 5
# last_digit(11) #=> 1
# last_digit(119) #=> 9
#
# You should assume the function will always be
# called with a non-negative whole number
def last_digit(n)
end
# Returns the last-but-one digit of a whole number
#
# penultimate_digit(5) #=> 0
# penultimate_digit(11) #=> 1
# penultimate_digit(119) #=> 1
#
# You should assume the function will always be
# called with a non-negative whole number
def penultimate_digit(n)
end
# Returns the appropriate 'th', 'nd', 'rd' or 'st' for
# a whole number
#
# ordinal_suffix(1) #=> 'st'
# ordinal_suffix(3) #=> 'rd'
# ordinal_suffix(5) #=> 'th'
# ordinal_suffix(11) #=> 'th'
# ordinal_suffix(22) #=> 'nd'
# ordinal_suffix(100) #=> 'th'
#
# You should assume the function will always be
# called with a non-negative whole number
def ordinal_suffix(n)
end
# Returns the date in words
#
# date_in_words('1/2/2014') #=> '1st February, 2014'
# date_in_words('12/11/2014') #=> '12th November, 2014'
#
def date_in_words(date_string)
end