Code Monkey home page Code Monkey logo

datever's Introduction

DateVer Godoc GitHub Release

Caution

This package is still experimental and the API may change in the future.

DateVer is a library to define, compare and validate date ranges while adhering to semantic versioning. DateVer versions consist of a year, month, day, and an optional patch. The patch can be used to indicate pre-release versions, such as alpha, beta, or release candidates. DateVer helps to provide a clear chronological view of your software's evolution.

Example DateVer versions

  • 2024.1.1
  • 2024.1.2-1
  • 2024.2.1-rc1
  • 2024.2.1-alpha001

Why DateVer?

Many projects use semantic versioning to manage their releases. However, the version number does not provide any information about the release date. DateVer combines the release date with semantic versioning to provide more context about the release.

Usage

This section details how to use datever.

Creating a DateVer version

version := &datever.Version{Year: 2024, Month: 2, Day: 1, Patch: "alpha001"}
fmt.Println(version.String()) // Output: 2024.2.1-alpha001

Parsing a DateVer version

version, err := datever.ParseVersion("2024.1.1-rc1")

Using a Version struct

Once you have a datever.Version struct, you can access its components (year, month, day, patch) and use the provided methods:

  • String(): Returns the string representation of the version.
  • IsValid(): Checks if the date components of the version are valid (year > 0, month within 1-12, day within 1-31).

datever's People

Contributors

bschaatsbergen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.