JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q38867F
  • License MIT

Extends class date with something more

Package Exports

  • datetimes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (datetimes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

datatimes

Extend class of Date

options

For now have an option: language (default: "ptBR"), and for now, only allowed some values:

  • enUS;
  • esMX;
  • ptBR;

Functions

  • format(stringFormat, [options]): string

    var date = new datetime(2017, 2, 22);
    date.format("dd/MM/yyyy"); // 22/03/2017
    
    var date2 = new datetime(2017, 2, 22);
    date2.format("dddd dd MMMM yyyy", { language: 'enUS' }); // wednesday 22 march 2017
    • stringFormats:
      • year
        • 01/01/2017 - yyyy => 2017
        • 01/01/2017 - yyy => 017
        • 01/01/2017 - yy => 17
        • 01/01/2017 - yy => 17
        • 01/01/2017 - y => 7
      • month
        • 01/01/2017 - MMMM => janeiro
        • 01/01/2017 - MMM => jan
        • 01/01/2017 - MM => 01
        • 01/01/2017 - M => 1
      • day:
        • 01/01/2017 - dddd => domingo
        • 01/01/2017 - ddd => dom
        • 01/01/2017 - dd => 01
        • 01/01/2017 - d => 1
      • hour:
        • 13:30:07 - HH => 13
        • 03:30:07 - H => 3
        • 13:30:07 - hh => 01
        • 13:30:07 - h => 3
      • minute:
        • 13:05:07 - mm => 05
      • second:
        • 13:05:07 - ss => 07
      • millisecond:
        • 13:05:07:123 - zzz => 123
  • now():

    var date = new datetime();
    date.now() // datetime => date time actual
  • noTimeZone():

    var Datetime = new datetime();
    Datetime.noTimeZone(3, 2017, 2, 22) // Will return the date 22/03/2017 without time zone