Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ph/170 date time support #9

Merged
merged 15 commits into from Jun 30, 2019
Merged

Ph/170 date time support #9

merged 15 commits into from Jun 30, 2019

Conversation

@Pavel-Hrdy
Copy link
Collaborator

Pavel-Hrdy commented Jun 26, 2019

What is implemented:

  • constructors
    dateTime(string) -  string is standardized format of date-time (ISO 8601)
    duration(string) - string is subset of standardized format of duration (ISO 8601)
    • allowed designators: D, T, H, M, S
    • only natural numbers are allowed
  • functions - below

Examples:
dateTime("1997-07-16T19:20")
duration("P5D1H3S")

Functions

  • arithmetic operations
    • +(DateTime,Duration) - adds Duration to DateTime and returns the sum as a new DateTime (commutative)
    • -(DateTime,Duration) - subtracts Duration from DateTime and returns the difference as a new DateTime 
    • +(Duration,Duration) - adds two Durations and returns the sum as a new Duration (commutative)
    • -(Duration,Duration) - subtracts two Durations and returns the difference as a new Duration
    • *(Duration,Integer) - multiplies Duration by the given Number and returns the result as a new Duration (commutative)
    • -(Duration) - negates Duration and returns it as a new Duration
    • /(Duration,Integer) - divides Duration by the given number and returns the truncated result as a new Duration
  • relational operations
    • <,<=,==,!=,>=,>(DateTime,DateTime) - compares two DateTimes, returns boolean
    • <,<=,==,!=,>=,>(Duration,Duration) - compares two Durations, returns boolean
    • all comparisons are independent of whether the time is in UTC or in the local time zone.
  • now() - returns DateTime with current date and time in the local time zone
  • nowInUtc() - returns DateTime with current date and time in the UTC time zone
  • diffDateTime(DateTime, DateTime) - returns difference between two DateTimes as an Duration in absolute value
  • durationInHours(Duration) - returns the Integer which represents the number of whole hours spanned by this Duration
  • durationInDays(Duration) - returns the Integer which represents the number of whole days spanned by this Duration
  • durationInMinutes(Duration) - returns the Integer which represents the number of whole minutes spanned by this Duration
  • durationInSeconds(Duration) - returns the Integer which represents the number of whole seconds spanned by this Duration
@Pavel-Hrdy Pavel-Hrdy requested a review from OndrejKunc Jun 26, 2019
@OndrejKunc OndrejKunc merged commit 00824a8 into master Jun 30, 2019
0 of 2 checks passed
0 of 2 checks passed
Travis CI - Branch Build Failed
Details
Travis CI - Pull Request Build Failed
Details
@OndrejKunc OndrejKunc deleted the ph/170-date-time-support branch Jul 1, 2019
@OndrejKunc OndrejKunc mentioned this pull request Oct 20, 2019
@muziling muziling mentioned this pull request Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.