-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdoc.go
More file actions
40 lines (40 loc) · 1.4 KB
/
doc.go
File metadata and controls
40 lines (40 loc) · 1.4 KB
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
// Package period provides a set of missing Time Range to Go. It is based on PHP Period http://period.thephpleague.com/
// period cover all basic operations regardings time ranges.
//
// Highlights
//
// Treats Time Range as immutable value objects
// Exposes many named constructors to ease time range creation
// Covers all basic manipulations related to time range
// Fully documented
// Framework-agnostic
//
// Questions?
//
// studiofrenetic/period was created by Studio Frentic. Find us on Twitter at @StudioFrenetic
//
// Examples
//
// // Accessing time range properties
// p, err := period.CreateFromMonth(2015, 3) // {2015-01-12 00:00:00 +0000 UTC 2015-01-19 00:00:00 +0000 UTC}
// if err != nil {
// log.Fatal(err)
// }
//
// // Comparing time ranges
// p, err := period.CreateFromWeek(2015, 3)
// if err != nil {
// log.Fatal(err)
// }
// alt := period.CreateFromDuration(time.Date(2015, 1, 14, 0, 0, 0, 0, time.UTC), time.Duration(24*7)*time.Hour) // {2015-01-14 00:00:00 +0000 UTC 2015-01-21 00:00:00 +0000 UTC}
// sameDuration := p.SameDurationAs(alt) // true
//
// p := period.CreateFromDuration(time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC), (time.Duration(2) * time.Hour))
// shouldContains := time.Date(2015, 1, 1, 0, 30, 0, 0, time.UTC)
// contains := p.Contains(shouldContains)
//
//
// // Modifying time ranges
// p.Next()
//
package period