func (dt *LocalDateTime) UnmarshalText(data []byte) error {
	var err error
	*dt, err = ParseLocalDateTime(string(data))
	return err
}
UnmarshalText implements the encoding.TextUnmarshaler interface.
The datetime is expected to be a string in a format accepted by ParseLocalDateTime
package toml
import (
	"fmt"
	"time"
)
type LocalDate struct {
	Year  int         
	Month time.Month  
	Day   int         
}
func LocalDateOf(t time.Time) LocalDate {
	var d LocalDate
	d.Year, d.Month, d.Day = t.Date()
	return d
}
func ParseLocalDate(s string) (LocalDate, error) {
	t, err := time.Parse("2006-01-02", s)
	if err != nil {
		return LocalDate{}, err
	}
	return LocalDateOf(t), nil
}
func (d LocalDate) String() string {
	return fmt.Sprintf("%04d-%02d-%02d", d.Year, d.Month, d.Day)
}
func (d LocalDate) IsValid() bool {
	return LocalDateOf(d.In(time.UTC)) == d
}
func (d LocalDate) In(loc *time.Location) time.Time {
	return time.Date(d.Year, d.Month, d.Day, 0, 0, 0, 0, loc)
}
func (d LocalDate) AddDays(n int) LocalDate {
	return LocalDateOf(d.In(time.UTC).AddDate(0, 0, n))
}
func (d LocalDate) DaysSince(s LocalDate) (days int) {
	deltaUnix := d.In(time.UTC).Unix() - s.In(time.UTC).Unix()
	return int(deltaUnix / 86400)
}
func (d1 LocalDate) Before(d2 LocalDate) bool {
	if d1.Year != d2.Year {
		return d1.Year < d2.Year
	}
	if d1.Month != d2.Month {
		return d1.Month < d2.Month
	}
	return d1.Day < d2.Day
}
func (d1 LocalDate) After(d2 LocalDate) bool {
	return d2.Before(d1)
}
func (d LocalDate) MarshalText() ([]byte, error) {
	return []byte(d.String()), nil
}
func (d *LocalDate) UnmarshalText(data []byte) error {
	var err error
	*d, err = ParseLocalDate(string(data))
	return err
}
type LocalTime struct {
	Hour       int  
	Minute     int  
	Second     int  
	Nanosecond int  
}
func LocalTimeOf(t time.Time) LocalTime {
	var tm LocalTime
	tm.Hour, tm.Minute, tm.Second = t.Clock()
	tm.Nanosecond = t.Nanosecond()
	return tm
}
func ParseLocalTime(s string) (LocalTime, error) {
	t, err := time.Parse("15:04:05.999999999", s)
	if err != nil {
		return LocalTime{}, err
	}
	return LocalTimeOf(t), nil
}
func (t LocalTime) String() string {
	s := fmt.Sprintf("%02d:%02d:%02d", t.Hour, t.Minute, t.Second)
	if t.Nanosecond == 0 {
		return s
	}
	return s + fmt.Sprintf(".%09d", t.Nanosecond)
}
func (t LocalTime) IsValid() bool {
	tm := time.Date(2, 2, 2, t.Hour, t.Minute, t.Second, t.Nanosecond, time.UTC)
	return LocalTimeOf(tm) == t
}
func (t LocalTime) MarshalText() ([]byte, error) {
	return []byte(t.String()), nil
}
func (t *LocalTime) UnmarshalText(data []byte) error {
	var err error
	*t, err = ParseLocalTime(string(data))
	return err
}
type LocalDateTime struct {
	Date LocalDate
	Time LocalTime
}
func LocalDateTimeOf(t time.Time) LocalDateTime {
	return LocalDateTime{
		Date: LocalDateOf(t),
		Time: LocalTimeOf(t),
	}
}
func ParseLocalDateTime(s string) (LocalDateTime, error) {
	t, err := time.Parse("2006-01-02T15:04:05.999999999", s)
	if err != nil {
		t, err = time.Parse("2006-01-02t15:04:05.999999999", s)
		if err != nil {
			return LocalDateTime{}, err
		}
	}
	return LocalDateTimeOf(t), nil
}
func (dt LocalDateTime) String() string {
	return dt.Date.String() + "T" + dt.Time.String()
}
func (dt LocalDateTime) IsValid() bool {
	return dt.Date.IsValid() && dt.Time.IsValid()
}
func (dt LocalDateTime) In(loc *time.Location) time.Time {
	return time.Date(dt.Date.Year, dt.Date.Month, dt.Date.Day, dt.Time.Hour, dt.Time.Minute, dt.Time.Second, dt.Time.Nanosecond, loc)
}
func (dt1 LocalDateTime) Before(dt2 LocalDateTime) bool {
	return dt1.In(time.UTC).Before(dt2.In(time.UTC))
}
func (dt1 LocalDateTime) After(dt2 LocalDateTime) bool {
	return dt2.Before(dt1)
}
func (dt LocalDateTime) MarshalText() ([]byte, error) {
	return []byte(dt.String()), nil
}