mui-temporal-pickers 1.1.0 → 1.1.2

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.
package/README.md CHANGED
@@ -122,7 +122,7 @@ Due to how `Intl.DateTimeFormat` works, text field formatting only supports nume
122
122
  `HH`, `mm`). Literal characters (like slashes or dashes) are fine.
123
123
 
124
124
  The only non-numeric token allowed is **AM/PM**, which is not currently localized and always displays as `"AM"` /
125
- `"PM"`.
125
+ `"PM"`. Additionally, "MMM" and "MMMM" are supported, although they might yield ideal values for every locale.
126
126
 
127
127
  ### No runtime validation of input types
128
128
 
@@ -52,7 +52,7 @@ const tokenToFieldMap = {
52
52
  a: "ampm",
53
53
  };
54
54
  const tokenRegexMap = {
55
- yy: "\\d{1,4}",
55
+ yy: "\\d{2}",
56
56
  yyyy: "\\d{4}",
57
57
  M: "\\d{1,2}",
58
58
  MM: "\\d{2}",
@@ -114,7 +114,7 @@ export class Formatter {
114
114
  return result;
115
115
  }
116
116
  parsePlainTime(value, format) {
117
- const tokens = parseTokenString(format);
117
+ const tokens = parseTokenString(this.expandFormat(format));
118
118
  const components = this.parseInputFromFormat(value, tokens);
119
119
  if (!components) {
120
120
  return null;
@@ -131,7 +131,7 @@ export class Formatter {
131
131
  }
132
132
  }
133
133
  parsePlainDate(value, format) {
134
- const tokens = parseTokenString(format);
134
+ const tokens = parseTokenString(this.expandFormat(format));
135
135
  const components = this.parseInputFromFormat(value, tokens);
136
136
  if (!components) {
137
137
  return null;
@@ -148,7 +148,7 @@ export class Formatter {
148
148
  }
149
149
  }
150
150
  parsePlainDateTime(value, format) {
151
- const tokens = parseTokenString(format);
151
+ const tokens = parseTokenString(this.expandFormat(format));
152
152
  const components = this.parseInputFromFormat(value, tokens);
153
153
  if (!components) {
154
154
  return null;
@@ -168,7 +168,7 @@ export class Formatter {
168
168
  }
169
169
  }
170
170
  parsePlainYearMonth(value, format) {
171
- const tokens = parseTokenString(format);
171
+ const tokens = parseTokenString(this.expandFormat(format));
172
172
  const components = this.parseInputFromFormat(value, tokens);
173
173
  if (!components) {
174
174
  return null;
@@ -184,7 +184,7 @@ export class Formatter {
184
184
  }
185
185
  }
186
186
  parsePlainMonthDay(value, format) {
187
- const tokens = parseTokenString(format);
187
+ const tokens = parseTokenString(this.expandFormat(format));
188
188
  const components = this.parseInputFromFormat(value, tokens);
189
189
  if (!components) {
190
190
  return null;
@@ -242,9 +242,9 @@ export class Formatter {
242
242
  if (value instanceof Temporal.PlainYearMonth || hasDate) {
243
243
  switch (token) {
244
244
  case "yy":
245
- return value.toString().slice(-2);
245
+ return value.year.toString().slice(-2).padStart(2, "0");
246
246
  case "yyyy":
247
- return value.year.toString();
247
+ return value.year.toString().padStart(4, "0");
248
248
  }
249
249
  }
250
250
  if (value instanceof Temporal.PlainYearMonth ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mui-temporal-pickers",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A small utility library providing Temporal support for MUI X Date and Time Pickers",
5
5
  "author": "Ben Scholzen 'DASPRiD'",
6
6
  "keywords": [