vendor/github.com/pelletier/go-toml/v2/localtime.go
changeset 265 05c40b36d3b2
parent 260 445e01aede7e
equal deleted inserted replaced
264:8f478162d991 265:05c40b36d3b2
     2 
     2 
     3 import (
     3 import (
     4 	"fmt"
     4 	"fmt"
     5 	"strings"
     5 	"strings"
     6 	"time"
     6 	"time"
       
     7 
       
     8 	"github.com/pelletier/go-toml/v2/unstable"
     7 )
     9 )
     8 
    10 
     9 // LocalDate represents a calendar day in no specific timezone.
    11 // LocalDate represents a calendar day in no specific timezone.
    10 type LocalDate struct {
    12 type LocalDate struct {
    11 	Year  int
    13 	Year  int
    73 
    75 
    74 // UnmarshalText parses b using RFC 3339 to fill d.
    76 // UnmarshalText parses b using RFC 3339 to fill d.
    75 func (d *LocalTime) UnmarshalText(b []byte) error {
    77 func (d *LocalTime) UnmarshalText(b []byte) error {
    76 	res, left, err := parseLocalTime(b)
    78 	res, left, err := parseLocalTime(b)
    77 	if err == nil && len(left) != 0 {
    79 	if err == nil && len(left) != 0 {
    78 		err = newDecodeError(left, "extra characters")
    80 		err = unstable.NewParserError(left, "extra characters")
    79 	}
    81 	}
    80 	if err != nil {
    82 	if err != nil {
    81 		return err
    83 		return err
    82 	}
    84 	}
    83 	*d = res
    85 	*d = res
   107 
   109 
   108 // UnmarshalText parses b using RFC 3339 to fill d.
   110 // UnmarshalText parses b using RFC 3339 to fill d.
   109 func (d *LocalDateTime) UnmarshalText(data []byte) error {
   111 func (d *LocalDateTime) UnmarshalText(data []byte) error {
   110 	res, left, err := parseLocalDateTime(data)
   112 	res, left, err := parseLocalDateTime(data)
   111 	if err == nil && len(left) != 0 {
   113 	if err == nil && len(left) != 0 {
   112 		err = newDecodeError(left, "extra characters")
   114 		err = unstable.NewParserError(left, "extra characters")
   113 	}
   115 	}
   114 	if err != nil {
   116 	if err != nil {
   115 		return err
   117 		return err
   116 	}
   118 	}
   117 
   119