1// Copyright 2016 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package currency_test
6
7import (
8	"fmt"
9	"time"
10
11	"golang.org/x/text/currency"
12)
13
14func ExampleQuery() {
15	t1799, _ := time.Parse("2006-01-02", "1799-01-01")
16	for it := currency.Query(currency.Date(t1799)); it.Next(); {
17		from := ""
18		if t, ok := it.From(); ok {
19			from = t.Format("2006-01-02")
20		}
21		fmt.Printf("%v is used in %v since: %v\n", it.Unit(), it.Region(), from)
22	}
23	// Output:
24	// GBP is used in GB since: 1694-07-27
25	// GIP is used in GI since: 1713-01-01
26	// USD is used in US since: 1792-01-01
27}
28