File: dates.go

package info (click to toggle)
golang-github-jackc-fake 0.0~git20150926.812a484-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 536 kB
  • sloc: makefile: 2
file content (42 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (3)
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
package fake

// Day generates day of the month
func Day() int {
	return r.Intn(31) + 1
}

// WeekDay generates name ot the week day
func WeekDay() string {
	return lookup(lang, "weekdays", true)
}

// WeekDayShort generates abbreviated name of the week day
func WeekDayShort() string {
	return lookup(lang, "weekdays_short", true)
}

// WeekdayNum generates number of the day of the week
func WeekdayNum() int {
	return r.Intn(7) + 1
}

// Month generates month name
func Month() string {
	return lookup(lang, "months", true)
}

// MonthShort generates abbreviated month name
func MonthShort() string {
	return lookup(lang, "months_short", true)
}

// MonthNum generates month number (from 1 to 12)
func MonthNum() int {
	return r.Intn(12) + 1
}

// Year generates year using the given boundaries
func Year(from, to int) int {
	n := r.Intn(to-from) + 1
	return from + n
}