@natch-the-storage/heathershaw-platform-types 1.18.12 → 1.18.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,6 +40,8 @@ export type AuStates = (typeof auStatesValues)[number];
40
40
  export type DiscountTiers = (typeof discountTierValues)[number];
41
41
  export declare const CHILD_AGE: 16;
42
42
  export declare const COMPOUNDING_CONTACT_EMAIL: "co@hcip.com.au";
43
+ /** General contact phone */
44
+ export declare const CONTACT_PHONE: "03 9509 7912";
43
45
  /** General privacy policy */
44
46
  export declare const POLICY_PRIVACY: "https://heathershawscompounding.com.au/privacy-policy/";
45
47
  /** Patient terms of sale policy */
@@ -81,12 +83,27 @@ export declare function getCurrentIsoTimestamp(): string;
81
83
  * @returns
82
84
  */
83
85
  export declare function formatDate(dateStr?: string | null, toDmy?: boolean): string;
86
+ /**
87
+ * Formats a date into a readable format
88
+ * @param date typically in ISO format - (yyyy-mm-ddThh:mm:sszz)
89
+ * @param time adds the time to the string
90
+ * @param toDmy format the date as dd/mm/yyyy instead
91
+ * @returns
92
+ */
93
+ export declare function formatIsoTimestamp({ date, time, toDmy, }: {
94
+ date: string;
95
+ time?: boolean;
96
+ toDmy?: boolean;
97
+ }): string;
84
98
  /**
85
99
  * Gets the age in years based on todays date vs the date of birth
86
100
  * @param dateOfBirth An isoDate (yyyy-mm-dd) string
87
101
  * @returns The age in years
88
102
  */
89
103
  export declare function getAge(dateOfBirth: string): number;
104
+ /**
105
+ * Formats an address object into a human readable format
106
+ */
90
107
  export declare function formatAddress(addr: Address): string;
91
108
  export interface Address {
92
109
  street: string;
@@ -106,6 +106,8 @@ export const discountTierValues = [
106
106
  //#region Constants ──────────────────────────────────────────────────────────────────
107
107
  export const CHILD_AGE = 16;
108
108
  export const COMPOUNDING_CONTACT_EMAIL = 'co@hcip.com.au';
109
+ /** General contact phone */
110
+ export const CONTACT_PHONE = '03 9509 7912';
109
111
  /** General privacy policy */
110
112
  export const POLICY_PRIVACY = 'https://heathershawscompounding.com.au/privacy-policy/';
111
113
  /** Patient terms of sale policy */
@@ -241,6 +243,34 @@ export function formatDate(dateStr, toDmy) {
241
243
  year: 'numeric',
242
244
  });
243
245
  }
246
+ /**
247
+ * Formats a date into a readable format
248
+ * @param date typically in ISO format - (yyyy-mm-ddThh:mm:sszz)
249
+ * @param time adds the time to the string
250
+ * @param toDmy format the date as dd/mm/yyyy instead
251
+ * @returns
252
+ */
253
+ export function formatIsoTimestamp({ date, time, toDmy, }) {
254
+ const d = new Date(date);
255
+ if (toDmy) {
256
+ return d.toLocaleDateString('en-AU', {
257
+ day: '2-digit',
258
+ month: '2-digit',
259
+ year: 'numeric',
260
+ hour: time ? '2-digit' : undefined,
261
+ minute: time ? '2-digit' : undefined,
262
+ timeZone: '+11',
263
+ });
264
+ }
265
+ return d.toLocaleDateString('en-AU', {
266
+ day: '2-digit',
267
+ month: 'short',
268
+ year: 'numeric',
269
+ hour: time ? '2-digit' : undefined,
270
+ minute: time ? '2-digit' : undefined,
271
+ timeZone: '+11',
272
+ });
273
+ }
244
274
  /**
245
275
  * Gets the age in years based on todays date vs the date of birth
246
276
  * @param dateOfBirth An isoDate (yyyy-mm-dd) string
@@ -256,6 +286,9 @@ export function getAge(dateOfBirth) {
256
286
  age -= 1;
257
287
  return age;
258
288
  }
289
+ /**
290
+ * Formats an address object into a human readable format
291
+ */
259
292
  export function formatAddress(addr) {
260
293
  return `${addr.street}, ${addr.suburb} ${addr.state} ${addr.postcode}`;
261
294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natch-the-storage/heathershaw-platform-types",
3
- "version": "1.18.12",
3
+ "version": "1.18.14",
4
4
  "description": "Interfaces and routes to use on the client",
5
5
  "license": "ISC",
6
6
  "author": "Natch Surana",