Socket
Socket
Sign inDemoInstall

@ltht-react/utils

Package Overview
Dependencies
82
Maintainers
1
Versions
295
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.0.3](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.0.2...@ltht-react/utils@0.0.3) (2020-01-07)
**Note:** Version bump only for package @ltht-react/utils
## [0.0.2](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.0.1...@ltht-react/utils@0.0.2) (2020-01-07)

@@ -8,0 +16,0 @@

2

lib/atoms/partial-date-time.d.ts
import { PartialDateTime } from '@ltht-react/types';
declare const partialDateTimeText: (date?: PartialDateTime | null | undefined) => string;
declare const partialDateTimeText: (partialDateTime?: PartialDateTime | null | undefined) => string;
export { partialDateTimeText };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var partialDateTimeText = function (date) {
if (!date || !date.value) {
return '';
}
var result = date.value
.toLocaleString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' })
var types_1 = require("@ltht-react/types");
var locale = 'en-GB';
var dayFormat = '2-digit';
var monthFormat = 'short';
var yearFormat = 'numeric';
var hourFormat = '2-digit';
var minuteFormat = '2-digit';
var formatDate = function (date) {
return date
.toLocaleString(locale, { day: dayFormat, month: monthFormat, year: yearFormat })
.split(' ')
.join('-');
return result;
};
var formatTime = function (date) {
return date
.toLocaleString(locale, { hour: hourFormat, minute: minuteFormat })
.split(' ')
.join(':');
};
var partialDateTimeText = function (partialDateTime) {
if (!partialDateTime || !partialDateTime.value) {
return '';
}
console.log(partialDateTime);
switch (partialDateTime.kind) {
case types_1.PartialDateTimeKindCode.Date:
return formatDate(new Date(partialDateTime.value));
case types_1.PartialDateTimeKindCode.DateTime:
var date = new Date(partialDateTime.value);
return formatDate(date) + " " + formatTime(date);
case types_1.PartialDateTimeKindCode.Year:
return new Date(partialDateTime.value).toLocaleString(locale, { year: yearFormat });
case types_1.PartialDateTimeKindCode.YearMonth:
return new Date(partialDateTime.value)
.toLocaleString(locale, { month: monthFormat, year: yearFormat })
.split(' ')
.join('-');
case types_1.PartialDateTimeKindCode.Time:
return formatTime(new Date(partialDateTime.value));
default:
return '';
}
};
exports.partialDateTimeText = partialDateTimeText;
//# sourceMappingURL=partial-date-time.js.map
{
"name": "@ltht-react/utils",
"version": "0.0.2",
"version": "0.0.3",
"description": "> TODO: description",

@@ -30,5 +30,5 @@ "author": "Jonny Smith <jonny.asmith@gmail.com>",

"dependencies": {
"@ltht-react/types": "^0.0.3"
"@ltht-react/types": "^0.0.4"
},
"gitHead": "b272edcd5223faa43f7359aefb865499942d873c"
"gitHead": "c284068fcfa5688c5a7a299aaa2ba4efaf54ca33"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc