Skip to content

Commit

Permalink
fix(date-time): Resolve issue with format date display
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Dec 23, 2023
1 parent 673b136 commit fde4545
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion frontend/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This package is part of the <b>⚡storm-stack</b> monorepo. The storm-stack pack

<h3 align="center">💻 Visit <a href="https://stormsoftware.org" target="_blank">stormsoftware.org</a> to stay up to date with this developer</h3><br />

[![Version](https://img.shields.io/badge/version-1.0.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
[![Version](https://img.shields.io/badge/version-1.0.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;
[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)

<h3 align="center" bold="true">⚠️ <b>Attention</b> ⚠️ This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.</h3><br />
Expand Down
10 changes: 7 additions & 3 deletions packages/date-time/src/utilities/format-date-time-iso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ import { StormDateTime } from "../storm-date-time";
*/
export const formatDateTimeISO = (
dateTime?: StormDateTime | null,
options: Partial<
Temporal.ToStringPrecisionOptions & Temporal.ShowCalendarOption
> = { smallestUnit: "milliseconds" }
options: Partial<Temporal.ZonedDateTimeToStringOptions> = {
smallestUnit: "milliseconds",
roundingMode: "ceil",
calendarName: "never",
timeZoneName: "never",
offset: "never"
}
): string =>
dateTime
? `${dateTime.instant
Expand Down
14 changes: 10 additions & 4 deletions packages/date-time/src/utilities/format-date-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ import { StormDateTime } from "../storm-date-time";
*/
export const formatDateTime = (
dateTime: StormDateTime = StormDateTime.current(),
options: Partial<
Temporal.ToStringPrecisionOptions & Temporal.ShowCalendarOption
> = { smallestUnit: "milliseconds" }
options: Partial<Temporal.ZonedDateTimeToStringOptions> = {
smallestUnit: "milliseconds",
roundingMode: "ceil",
calendarName: "never",
timeZoneName: "never",
offset: "never"
}
): string =>
dateTime ? `${dateTime.zonedDateTime.toString(options)}` : EMPTY_STRING;
dateTime
? `${dateTime.zonedDateTime.toString(options).replaceAll("T", " ")}`
: EMPTY_STRING;
10 changes: 7 additions & 3 deletions packages/date-time/src/utilities/format-date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { StormDateTime } from "../storm-date-time";
*/
export const formatDate = (
dateTime: StormDateTime = StormDate.current(),
options: Partial<
Temporal.ToStringPrecisionOptions & Temporal.ShowCalendarOption
> = { smallestUnit: "minute" }
options: Partial<Temporal.ZonedDateTimeToStringOptions> = {
smallestUnit: "minute",
roundingMode: "ceil",
calendarName: "never",
timeZoneName: "never",
offset: "never"
}
): string => dateTime.zonedDateTime.toPlainDate().toString(options);
10 changes: 7 additions & 3 deletions packages/date-time/src/utilities/format-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { StormTime } from "../storm-time";
*/
export const formatTime = (
dateTime: StormDateTime = StormTime.current(),
options: Partial<
Temporal.ToStringPrecisionOptions & Temporal.ShowCalendarOption
> = { smallestUnit: "milliseconds" }
options: Partial<Temporal.ZonedDateTimeToStringOptions> = {
smallestUnit: "milliseconds",
roundingMode: "ceil",
calendarName: "never",
timeZoneName: "never",
offset: "never"
}
): string => dateTime.zonedDateTime.toPlainTime().toString(options);

0 comments on commit fde4545

Please sign in to comment.