ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - ijt/go-anytime: Parse natural and standardized dates/times and ranges in Go without knowing the format in advance
Parse natural and standardized dates/times and ranges in Go without knowing the format in advance - ijt/go-anytime
Visit Site

GitHub - ijt/go-anytime: Parse natural and standardized dates/times and ranges in Go without knowing the format in advance

GitHub - ijt/go-anytime: Parse natural and standardized dates/times and ranges in Go without knowing the format in advance

Go Anytime

Go Report Card codecov GoDoc Awesome

Natural date time parsing for Go. This package was originally forked from github.com/tj/go-naturaldate but has diverged so much that it needed a new name to avoid confusion. Here are the largest differences:

  1. The go-anytime module is written in terms of the github.com/ijt/goparsify parser combinator module, rather than the github.com/pointlander/peg parsing module. That made its development and debugging easier, and also means that its parsers can be use within other parsers that use ijt/goparsify.
  2. Ranges can be parsed using ParseRange or RangeParser, for example "from 3 feb 2022 until 6 oct 2022".
  3. Dates/times and ranges can be replaced in strings using the funcs ReplaceTimesByFunc, ReplaceRangesByFunc, and ReplaceDateRangesByFunc.
  4. Strings can be partitioned into time and non-time parts using the funcs PartitionTimes and PartitionTimesByFuncs.

Examples

Here are some examples of expressions that can be parsed by anytime.Parse() or anytime.Parser:

  • now
  • today
  • yesterday
  • 5 minutes ago
  • three days ago
  • last month
  • next month
  • one year from now
  • yesterday at 10am
  • last sunday at 5:30pm
  • next sunday at 22:45
  • next January
  • last February
  • next December 25th at 7:30am
  • next December 25th at 7:30am UTC-7
  • November 3rd, 1986 at 4:30pm
  • january 2017
  • january, 2017
  • oct 7, 1970
  • oct 7 1970
  • 7 oct 1970
  • 7 oct, 1970
  • September 17, 2012 UTC+7
  • September 17, 2012
  • 03 February 2013
  • 2 July 2013
  • 2014/3/31
  • 2014/3/31 UTC
  • 2014/3/31 UTC+1
  • 2014/03/31
  • 2014/03/31 UTC-1
  • 2014-04-26
  • 2014-4-26
  • 2014-4-6
  • 31/3/2014 UTC-8
  • 31-3-2014 UTC-8
  • 31/3/2014
  • 31-3-2014
  • January
  • december 20
  • thursday at 23:59
  • See the tests for more examples

Range examples

Here are some examples of expressions that can be parsed by anytime.ParseRange() or anytime.RangeParser:

  • from 3 feb 2022 to 6 oct 2022
  • 3 feb 2022 to 6 oct 2022
  • from 3 feb 2022 until 6 oct 2022
  • from tuesday at 5pm -12:00 until thursday 23:52 +14:00
  • last year
  • today
  • next week

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory