Giter Site home page Giter Site logo

abjerner / skybrud.umbraco.time Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 641 KB

Extended date and time based property editors for Umbraco.

License: MIT License

Batchfile 0.74% JavaScript 13.08% CSS 5.29% HTML 8.96% C# 66.24% Less 5.69%
skybrud limbo umbraco umbraco-v8 umbraco-package umbraco-packages umbraco-cms umbraco-backoffice dotnet package

skybrud.umbraco.time's Introduction

Skybrud.Umbraco.Time

Skybrud.Umbraco.Time is a small package for Umbraco 8 that adds three new property editors:

While Umbraco already features a property editor for picking a date (or date and time), the property editors in this package handles more specific use cases (eg. the date picker will return EssentialsDate instead of DateTime).

Installation

The Umbraco 9 version of this package is only available via NuGet. To install the package, you can use either .NET CLI:

dotnet add package Skybrud.Umbraco.Time --version 2.0.0

or the older NuGet Package Manager:

Install-Package Skybrud.Umbraco.Time -Version 2.0.0

Umbraco 8
For the Umbraco 8 version of this package, see the v1/main branch instead.

Screenshots

Examples of the date and time property editors respectively image

Date Picker

The date picker uses Umbraco's own date picker view, but ensures that the view is configured for selecting a date without any time. The property editor should be used in situations where only the date matters, and as such it returns an instance of EssentialsDate instead of the normal DateTime.

The EssentialsDate class comes from our Skybrud.Essentials package, which provides extended functionality for working with dates compared to DateTime.

Calling the ToString method on said class will result in a string representation of the date formatted using the ISO 8601 date format, which is yyyy-MM-dd - eg. 2020-08-07. The same format is used when serializing the value using Json.NET.

As of this time, the date picker currently doesn't have any prevalues (data type configuration).

Time Picker

The time picker uses a custom view for letting editors pick a time without any relation to a specific date. The picker returns an instance of TimeOffset representing the selected time, and the Hours and Minutes properties can be used to read the selected selected time.

Calling the ToString method will result in a string representation of the date formatted as HH:mm. The ToString method is also used when serializing the value using Json.NET.

The output format of the ToString method can be controlled via the Output format prevalue option in the data type configuration. The format is that of the TimeSpan class in .NET. Notice that the format is different from that of the DateTime class, so a format like hh\:mm will result is something like 15:45 (which for DateTime would have been HH:mm).

image

UNIX Timestamp

The UNIX timestamp property editor looks like the picker for date and time that ships with Umbraco, but instead of of saving the date and time as DateTime in the database, this property editor will save the date and time as a UNIX timestamp - which is the amount of seconds since the start of the UNIX epoch. And instead of DateTime, the property value type will instead be the EssentialsTime class.

Aditionally, data types using this property editor may be configured to adjust the date and time to a specific time zone, which then is reflected in the EssentialsTime instance.

Calling the ToString method on a EssentialsTime will result in a string representation of the date and time formatted using the ISO 8601 date time format, which is yyyy-MM-ddTHH:mm:ssK - eg. 1988-08-17T08:37:00+02:00. The same format is used when serializing the value using Json.NET.

skybrud.umbraco.time's People

Contributors

abjerner avatar nikcio avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nikcio

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.