Documentation
¶
Index ¶
- func Add(ctx context.Context, arg1, arg2, arg3 runtime.Value) (runtime.Value, error)
- func Day(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func DayOfWeek(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func DayOfYear(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func DaysInMonth(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Diff(ctx context.Context, arg1, arg2, arg3 runtime.Value) (runtime.Value, error)
- func Format(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)
- func Hour(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func IsLeapYear(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Millisecond(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Minute(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Month(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Now(_ context.Context) (runtime.Value, error)
- func Parse(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func Quarter(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func RegisterLib(ns runtime.Namespace)
- func Same(_ context.Context, arg1, arg2, arg3 runtime.Value) (runtime.Value, error)
- func Second(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Subtract(ctx context.Context, arg1, arg2, arg3 runtime.Value) (runtime.Value, error)
- func Year(_ context.Context, arg runtime.Value) (runtime.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add adds an integer number of units to a date. Subday units are elapsed time; calendar units use Go AddDate in the input's location, normalizing month ends rather than clamping them. A calendar day can span 23 or 25 elapsed hours. @param date {DateTime} Source date. @param amount {Int} Number of units to add; may be negative. @param unit {String} Millisecond, second, minute, hour, day, week, month, or year; plurals are accepted. @return {DateTime} Calculated date, retaining the input's location. @throws {RangeError} The shift or resulting date cannot be represented safely.
func Day ¶
Day returns the day of date as a number. @param date {DateTime} Source DateTime. @return {Int} A day number.
func DayOfWeek ¶
DayOfWeek returns number of the weekday from the date. Sunday is the 0th day of week. @param date {DateTime} Source DateTime. @return {Int} Number of the weekday.
func DayOfYear ¶
DayOfYear returns the day of year number of date. The return value range from 1 to 365 (366 in a leap year). @param date {DateTime} Source DateTime. @return {Int} A day of year number.
func DaysInMonth ¶
DaysInMonth returns the number of days in the input's local calendar month. @param date {DateTime} Source date. @return {Int} Number of calendar days in the month, including leap days.
func Diff ¶
Diff returns the signed elapsed difference right - left in fixed units. It uses checked runtime subtraction, limited to Duration's roughly 292-year range. @param left {DateTime} Starting instant. @param right {DateTime} Ending instant. @param unit {String} Millisecond, second, minute, or hour; plurals are accepted. Calendar units are rejected. @return {Float} Signed fractional elapsed units; reversing arguments reverses the sign. @throws {TypeError} An argument has an invalid type. @throws {InvalidArgument} The unit is unknown or is a calendar unit. @throws {RangeError} The elapsed interval cannot fit a runtime Duration.
func Format ¶
Format renders a DateTime using a Go time layout. @param date {DateTime} Source DateTime object. @param format {String} Go time layout. @return {String} Formatted date.
func Hour ¶
Hour returns the hour of date as a number. @param date {DateTime} Source DateTime. @return {Int} An hour number.
func IsLeapYear ¶
IsLeapYear returns true if date is in a leap year else false. @param date {DateTime} Source DateTime. @return {Boolean} Whether the date is in a leap year.
func Millisecond ¶
Millisecond returns the millisecond of date as a number. @param date {DateTime} Source DateTime. @return {Int} A millisecond number.
func Minute ¶
Minute returns the minute of date as a number. @param date {DateTime} Source DateTime. @return {Int} A minute number.
func Month ¶
Month returns the month of date as a number. @param date {DateTime} Source DateTime. @return {Int} A month number.
func Now ¶
Now returns new DateTime object with Time equal to time.Now(). @return {DateTime} New DateTime object.
func Parse ¶
Parse parses a String using an optional Go time layout, defaulting to RFC3339. @param time {String} String representation of DateTime. @param layout {String} Go time layout. @return {DateTime} Parsed DateTime, preserving the parsed offset.
func Quarter ¶
Quarter returns which quarter date belongs to. @param date {DateTime} Source DateTime. @return {Int} A quarter number.
func RegisterLib ¶
RegisterLib registers canonical datetime functions and deprecated global adapters. @namespace datetime
func Same ¶
Same compares each input's own local calendar through the requested precision. Offset and location identity are ignored. Week compares ISO week-year and week number; other units require all enclosing calendar fields to match. @param left {DateTime} First date. @param right {DateTime} Second date. @param unit {String} Precision: year, month, week, day, hour, minute, second, or millisecond; plurals are accepted. @return {Boolean} Whether the local calendar values match through that precision. @throws {TypeError} An argument has an invalid type. @throws {InvalidArgument} The unit is unknown.
func Second ¶
Second returns the second of date as a number. @param date {DateTime} Source DateTime. @return {Int} A second number.
func Subtract ¶
Subtract subtracts an integer number of units from a date. Subday units are elapsed time; calendar units use Go AddDate in the input's location, normalizing month ends rather than clamping them. A calendar day can span 23 or 25 hours. @param date {DateTime} Source date. @param amount {Int} Number of units to subtract; may be negative. @param unit {String} Millisecond, second, minute, hour, day, week, month, or year; plurals are accepted. @return {DateTime} Calculated date, retaining the input's location. @throws {RangeError} The shift or resulting date cannot be represented safely.
Types ¶
This section is empty.