Giter Site home page Giter Site logo

datebycountry's Introduction

DateByCountry

A Library which can tranform you date string into the any date by country to want.

Use Case

date: string = '01/01/2023'

{{ date | dateByCountry: locale : options }}

eg:- {{date | dateByCountry: 'en-UK' : 'yn-mn-dn-wl-hn-Mn-sn' }}

locale

ISO code

Options

In options we have the following weekday, year, month, day, hour, minute, second.

Year

The representation of the year. Possible values are:
"numeric" (e.g., 2012)
"2-digit" (e.g., 12)

month

The representation of the month. Possible values are:
"numeric" (e.g., 3)
"2-digit" (e.g., 03)
"long" (e.g., March)
"short" (e.g., Mar)
"narrow" (e.g., M). Two months may have the same narrow style for some locales (e.g. May's narrow style is also M).

day

The representation of the day. Possible values are:
"numeric" (e.g., 1)
"2-digit" (e.g., 01)

hour

The representation of the hour. Possible values are "numeric", "2-digit".

minute

The representation of the minute. Possible values are "numeric", "2-digit".

second

The representation of the second. Possible values are "numeric","2-digit".

If you have to pass this to dateByCountry then just options first alphabet with value first alphabet

eg:- eg:- {{date | dateByCountry: 'en-UK' : 'yn-mn-dn-wl-hn-Mn-sn' }}

Example

yn - year with numeric
mn - month with numeric
dn - day with numeric
wl - weekday with long
hn - hours with numeric
Mn - Minutes with numeric
sn - second with numeric

Hours Format

{{date | dateByCountry: 'en-UK' : 'yn-mn-dn-wl-hn-Mn-sn' : 'H-true' }}
true :  12 hours format 
false: 24 hours format

TimeZone

{{date | dateByCountry: 'en-UK' : 'yn-mn-dn-wl-hn-Mn-sn' : 'H-true' : 'T-America/Los_Angeles' }}

Time Zones

Reference: Mozilla docs

datebycountry's People

Contributors

sannanansari avatar

Watchers

 avatar  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.