quasar 1.17.7 → 1.18.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.
Files changed (131) hide show
  1. package/dist/api/QCheckbox.json +27 -0
  2. package/dist/api/QRadio.json +18 -0
  3. package/dist/api/QToggle.json +24 -25
  4. package/dist/icon-set/bootstrap-icons.umd.min.js +1 -1
  5. package/dist/icon-set/eva-icons.umd.min.js +1 -1
  6. package/dist/icon-set/fontawesome-v5-pro.umd.min.js +1 -1
  7. package/dist/icon-set/fontawesome-v5.umd.min.js +1 -1
  8. package/dist/icon-set/ionicons-v4.umd.min.js +1 -1
  9. package/dist/icon-set/line-awesome.umd.min.js +1 -1
  10. package/dist/icon-set/material-icons-outlined.umd.min.js +1 -1
  11. package/dist/icon-set/material-icons-round.umd.min.js +1 -1
  12. package/dist/icon-set/material-icons-sharp.umd.min.js +1 -1
  13. package/dist/icon-set/material-icons.umd.min.js +1 -1
  14. package/dist/icon-set/mdi-v3.umd.min.js +1 -1
  15. package/dist/icon-set/mdi-v4.umd.min.js +1 -1
  16. package/dist/icon-set/mdi-v5.umd.min.js +1 -1
  17. package/dist/icon-set/mdi-v6.umd.min.js +1 -1
  18. package/dist/icon-set/svg-bootstrap-icons.umd.min.js +1 -1
  19. package/dist/icon-set/svg-eva-icons.umd.min.js +1 -1
  20. package/dist/icon-set/svg-fontawesome-v5.umd.min.js +1 -1
  21. package/dist/icon-set/svg-ionicons-v4.umd.min.js +1 -1
  22. package/dist/icon-set/svg-ionicons-v5.umd.min.js +1 -1
  23. package/dist/icon-set/svg-ionicons-v6.umd.min.js +1 -1
  24. package/dist/icon-set/svg-line-awesome.umd.min.js +1 -1
  25. package/dist/icon-set/svg-material-icons-outlined.umd.min.js +1 -1
  26. package/dist/icon-set/svg-material-icons-round.umd.min.js +1 -1
  27. package/dist/icon-set/svg-material-icons-sharp.umd.min.js +1 -1
  28. package/dist/icon-set/svg-material-icons.umd.min.js +1 -1
  29. package/dist/icon-set/svg-mdi-v4.umd.min.js +1 -1
  30. package/dist/icon-set/svg-mdi-v5.umd.min.js +1 -1
  31. package/dist/icon-set/svg-mdi-v6.umd.min.js +1 -1
  32. package/dist/icon-set/svg-themify.umd.min.js +1 -1
  33. package/dist/icon-set/themify.umd.min.js +1 -1
  34. package/dist/lang/ar.umd.min.js +1 -1
  35. package/dist/lang/az-latn.umd.min.js +1 -1
  36. package/dist/lang/bg.umd.min.js +1 -1
  37. package/dist/lang/ca.umd.min.js +1 -1
  38. package/dist/lang/cs.umd.min.js +1 -1
  39. package/dist/lang/da.umd.min.js +1 -1
  40. package/dist/lang/de.umd.min.js +1 -1
  41. package/dist/lang/el.umd.min.js +1 -1
  42. package/dist/lang/en-gb.umd.min.js +1 -1
  43. package/dist/lang/en-us.umd.min.js +1 -1
  44. package/dist/lang/eo.umd.min.js +1 -1
  45. package/dist/lang/es.umd.min.js +1 -1
  46. package/dist/lang/et.umd.min.js +1 -1
  47. package/dist/lang/fa-ir.umd.min.js +1 -1
  48. package/dist/lang/fa.umd.min.js +1 -1
  49. package/dist/lang/fi.umd.min.js +1 -1
  50. package/dist/lang/fr.umd.min.js +1 -1
  51. package/dist/lang/gn.umd.min.js +1 -1
  52. package/dist/lang/he.umd.min.js +1 -1
  53. package/dist/lang/hr.umd.min.js +1 -1
  54. package/dist/lang/hu.umd.min.js +1 -1
  55. package/dist/lang/id.umd.min.js +1 -1
  56. package/dist/lang/is.umd.min.js +1 -1
  57. package/dist/lang/it.umd.min.js +1 -1
  58. package/dist/lang/ja.umd.min.js +1 -1
  59. package/dist/lang/km.umd.min.js +1 -1
  60. package/dist/lang/ko-kr.umd.min.js +1 -1
  61. package/dist/lang/kur-ckb.umd.min.js +1 -1
  62. package/dist/lang/lu.umd.min.js +1 -1
  63. package/dist/lang/lv.umd.min.js +1 -1
  64. package/dist/lang/ml.umd.min.js +1 -1
  65. package/dist/lang/ms.umd.min.js +1 -1
  66. package/dist/lang/my.umd.min.js +1 -1
  67. package/dist/lang/nb-no.umd.min.js +1 -1
  68. package/dist/lang/nl.umd.min.js +1 -1
  69. package/dist/lang/pl.umd.min.js +1 -1
  70. package/dist/lang/pt-br.umd.min.js +1 -1
  71. package/dist/lang/pt.umd.min.js +1 -1
  72. package/dist/lang/ro.umd.min.js +1 -1
  73. package/dist/lang/ru.umd.min.js +1 -1
  74. package/dist/lang/sk.umd.min.js +1 -1
  75. package/dist/lang/sl.umd.min.js +1 -1
  76. package/dist/lang/sr.umd.min.js +1 -1
  77. package/dist/lang/sv.umd.min.js +1 -1
  78. package/dist/lang/ta.umd.min.js +1 -1
  79. package/dist/lang/th.umd.min.js +1 -1
  80. package/dist/lang/tr.umd.min.js +1 -1
  81. package/dist/lang/ug.umd.min.js +1 -1
  82. package/dist/lang/uk.umd.min.js +1 -1
  83. package/dist/lang/vi.umd.min.js +1 -1
  84. package/dist/lang/zh-hans.umd.min.js +1 -1
  85. package/dist/lang/zh-hant.umd.min.js +1 -1
  86. package/dist/quasar.addon.css +1 -1
  87. package/dist/quasar.addon.rtl.css +1 -1
  88. package/dist/quasar.common.js +2 -2
  89. package/dist/quasar.css +45 -11
  90. package/dist/quasar.esm.js +2 -2
  91. package/dist/quasar.ie.polyfills.js +1 -1
  92. package/dist/quasar.ie.polyfills.umd.min.js +1 -1
  93. package/dist/quasar.min.css +1 -1
  94. package/dist/quasar.rtl.css +58 -24
  95. package/dist/quasar.rtl.min.css +1 -1
  96. package/dist/quasar.sass +31 -11
  97. package/dist/quasar.styl +31 -11
  98. package/dist/quasar.umd.js +329 -195
  99. package/dist/quasar.umd.min.js +2 -2
  100. package/dist/quasar.umd.modern.js +319 -193
  101. package/dist/quasar.umd.modern.min.js +2 -2
  102. package/dist/types/index.d.ts +32 -12
  103. package/dist/types/utils/date.d.ts +28 -13
  104. package/dist/vetur/quasar-attributes.json +32 -12
  105. package/dist/vetur/quasar-tags.json +8 -3
  106. package/dist/web-types/web-types.json +73 -28
  107. package/package.json +1 -1
  108. package/src/components/checkbox/QCheckbox.js +48 -22
  109. package/src/components/checkbox/QCheckbox.json +17 -0
  110. package/src/components/checkbox/QCheckbox.sass +17 -5
  111. package/src/components/checkbox/QCheckbox.styl +17 -5
  112. package/src/components/field/QField.sass +2 -0
  113. package/src/components/field/QField.styl +2 -0
  114. package/src/components/form/QForm.js +17 -14
  115. package/src/components/input/QInput.js +9 -0
  116. package/src/components/radio/QRadio.js +43 -19
  117. package/src/components/radio/QRadio.json +16 -0
  118. package/src/components/radio/QRadio.sass +17 -5
  119. package/src/components/radio/QRadio.styl +17 -5
  120. package/src/components/select/QSelect.js +3 -2
  121. package/src/components/stepper/QStep.js +1 -1
  122. package/src/components/toggle/QToggle.js +0 -3
  123. package/src/components/toggle/QToggle.json +3 -13
  124. package/src/components/tree/QTree.js +6 -8
  125. package/src/mixins/checkbox.js +4 -0
  126. package/src/mixins/checkbox.json +18 -0
  127. package/src/mixins/validate.js +19 -16
  128. package/src/mixins/virtual-scroll.js +6 -4
  129. package/src/plugins/Meta.js +1 -1
  130. package/src/plugins/Screen.js +15 -9
  131. package/src/utils/date.js +151 -94
package/src/utils/date.js CHANGED
@@ -19,8 +19,8 @@ function getRegexData (mask, dateLocale) {
19
19
  days = '(' + dateLocale.days.join('|') + ')',
20
20
  key = mask + days
21
21
 
22
- if (regexStore[key] !== void 0) {
23
- return regexStore[key]
22
+ if (regexStore[ key ] !== void 0) {
23
+ return regexStore[ key ]
24
24
  }
25
25
 
26
26
  const
@@ -138,7 +138,7 @@ function getRegexData (mask, dateLocale) {
138
138
 
139
139
  default:
140
140
  index--
141
- if (match[0] === '[') {
141
+ if (match[ 0 ] === '[') {
142
142
  match = match.substring(1, match.length - 1)
143
143
  }
144
144
  return match.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
@@ -146,7 +146,7 @@ function getRegexData (mask, dateLocale) {
146
146
  })
147
147
 
148
148
  const res = { map, regex: new RegExp('^' + regexText) }
149
- regexStore[key] = res
149
+ regexStore[ key ] = res
150
150
 
151
151
  return res
152
152
  }
@@ -174,25 +174,18 @@ function formatTimezone (offset, delimeter = '') {
174
174
  function applyYearMonthDayChange (date, mod, sign) {
175
175
  let
176
176
  year = date.getFullYear(),
177
- month = date.getMonth(),
178
- day = date.getDate()
177
+ month = date.getMonth()
179
178
 
180
- if (mod.years !== void 0) {
181
- year += sign * mod.years
182
- }
183
- else if (mod.year !== void 0) {
179
+ const day = date.getDate()
180
+
181
+ if (mod.year !== void 0) {
184
182
  year += sign * mod.year
183
+ delete mod.year
185
184
  }
186
185
 
187
- if (mod.months !== void 0) {
188
- month += sign * mod.months
189
- }
190
- else if (mod.month !== void 0) {
186
+ if (mod.month !== void 0) {
191
187
  month += sign * mod.month
192
- }
193
-
194
- if (mod.days !== void 0) {
195
- day += sign * mod.days
188
+ delete mod.month
196
189
  }
197
190
 
198
191
  date.setDate(1)
@@ -200,74 +193,110 @@ function applyYearMonthDayChange (date, mod, sign) {
200
193
 
201
194
  date.setFullYear(year)
202
195
  date.setMonth(month)
203
- date.setDate(day)
196
+ date.setDate(Math.min(day, daysInMonth(date)))
197
+
198
+ if (mod.date !== void 0) {
199
+ date.setDate(date.getDate() + sign * mod.date)
200
+ delete mod.date
201
+ }
204
202
 
205
203
  return date
206
204
  }
207
205
 
208
- const yearMonDay = [ 'years', 'year', 'months', 'month', 'days' ]
206
+ function applyYearMonthDay (date, mod, middle) {
207
+ const
208
+ year = mod.year !== void 0 ? mod.year : date[ `get${middle}FullYear` ](),
209
+ month = mod.month !== void 0 ? mod.month - 1 : date[ `get${middle}Month` ](),
210
+ maxDay = (new Date(year, month + 1, 0)).getDate(),
211
+ day = Math.min(maxDay, mod.date !== void 0 ? mod.date : date[ `get${middle}Date` ]())
212
+
213
+ date[ `set${middle}Date` ](1)
214
+ date[ `set${middle}Month` ](2)
215
+
216
+ date[ `set${middle}FullYear` ](year)
217
+ date[ `set${middle}Month` ](month)
218
+ date[ `set${middle}Date` ](day)
219
+
220
+ delete mod.year
221
+ delete mod.month
222
+ delete mod.date
223
+
224
+ return date
225
+ }
209
226
 
210
- function getChange (date, mod, sign) {
227
+ function getChange (date, rawMod, sign) {
211
228
  const
229
+ mod = normalizeMod(rawMod),
212
230
  d = new Date(date),
213
- t = (
214
- mod.years !== void 0 || mod.year !== void 0 ||
215
- mod.months !== void 0 || mod.month !== void 0 ||
216
- mod.days !== void 0
217
- )
218
- ? applyYearMonthDayChange(d, mod, sign)
231
+ t = mod.year !== void 0 || mod.month !== void 0 || mod.date !== void 0
232
+ ? applyYearMonthDayChange(d, mod, sign) // removes year/month/day
219
233
  : d
220
234
 
221
235
  for (const key in mod) {
222
- if (yearMonDay.includes(key) === false) {
223
- const op = capitalize(key)
224
- t[`set${op}`](t[`get${op}`]() + sign * mod[key])
225
- }
236
+ const op = capitalize(key)
237
+ t[ `set${op}` ](t[ `get${op}` ]() + sign * mod[ key ])
226
238
  }
227
239
 
228
240
  return t
229
241
  }
230
242
 
231
- function applyYearMonthDay (date, mod, middle) {
232
- const
233
- year = mod.year !== void 0
234
- ? mod.year
235
- : (mod.years !== void 0 ? mod.years : date[`get${middle}FullYear`]()),
236
- month = mod.month !== void 0
237
- ? mod.month - 1
238
- : (mod.months !== void 0 ? mod.months : date[`get${middle}Month`]()),
239
- maxDay = (new Date(year, month + 1, 0)).getDate(),
240
- day = Math.min(maxDay, mod.date !== void 0 ? mod.date : date[`get${middle}Date`]())
243
+ function normalizeMod (mod) {
244
+ const acc = { ...mod }
241
245
 
242
- date[`set${middle}Date`](1)
243
- date[`set${middle}Month`](2)
246
+ if (mod.years !== void 0) {
247
+ acc.year = mod.years
248
+ delete acc.years
249
+ }
244
250
 
245
- date[`set${middle}FullYear`](year)
246
- date[`set${middle}Month`](month)
247
- date[`set${middle}Date`](day)
251
+ if (mod.months !== void 0) {
252
+ acc.month = mod.months
253
+ delete acc.months
254
+ }
248
255
 
249
- return date
250
- }
256
+ if (mod.days !== void 0) {
257
+ acc.date = mod.days
258
+ delete acc.days
259
+ }
260
+ if (mod.day !== void 0) {
261
+ acc.date = mod.day
262
+ delete acc.day
263
+ }
264
+
265
+ if (mod.hour !== void 0) {
266
+ acc.hours = mod.hour
267
+ delete acc.hour
268
+ }
251
269
 
252
- const yearMonDayAdj = [ 'years', 'year', 'months', 'month', 'days' ]
270
+ if (mod.minute !== void 0) {
271
+ acc.minutes = mod.minute
272
+ delete acc.minute
273
+ }
253
274
 
254
- export function adjustDate (date, mod, utc) {
275
+ if (mod.second !== void 0) {
276
+ acc.seconds = mod.second
277
+ delete acc.second
278
+ }
279
+
280
+ if (mod.millisecond !== void 0) {
281
+ acc.milliseconds = mod.millisecond
282
+ delete acc.millisecond
283
+ }
284
+
285
+ return acc
286
+ }
287
+
288
+ export function adjustDate (date, rawMod, utc) {
255
289
  const
290
+ mod = normalizeMod(rawMod),
256
291
  middle = utc === true ? 'UTC' : '',
257
292
  d = new Date(date),
258
- t = (
259
- mod.years !== void 0 || mod.year !== void 0 ||
260
- mod.months !== void 0 || mod.month !== void 0 ||
261
- mod.days !== void 0
262
- )
263
- ? applyYearMonthDay(d, mod, middle)
293
+ t = mod.year !== void 0 || mod.month !== void 0 || mod.date !== void 0
294
+ ? applyYearMonthDay(d, mod, middle) // removes year/month/day
264
295
  : d
265
296
 
266
297
  for (const key in mod) {
267
- if (yearMonDayAdj.includes(key) === false) {
268
- const op = key.charAt(0).toUpperCase() + key.slice(1)
269
- t[`set${middle}${op}`](mod[key])
270
- }
298
+ const op = key.charAt(0).toUpperCase() + key.slice(1)
299
+ t[ `set${middle}${op}` ](mod[ key ])
271
300
  }
272
301
 
273
302
  return t
@@ -338,7 +367,7 @@ export function __splitDate (str, mask, dateLocale, calendar, defaultModel) {
338
367
  let tzString = ''
339
368
 
340
369
  if (map.X !== void 0 || map.x !== void 0) {
341
- const stamp = parseInt(match[map.X !== void 0 ? map.X : map.x], 10)
370
+ const stamp = parseInt(match[ map.X !== void 0 ? map.X : map.x ], 10)
342
371
 
343
372
  if (isNaN(stamp) === true || stamp < 0) {
344
373
  return date
@@ -356,28 +385,28 @@ export function __splitDate (str, mask, dateLocale, calendar, defaultModel) {
356
385
  }
357
386
  else {
358
387
  if (map.YYYY !== void 0) {
359
- date.year = parseInt(match[map.YYYY], 10)
388
+ date.year = parseInt(match[ map.YYYY ], 10)
360
389
  }
361
390
  else if (map.YY !== void 0) {
362
- const y = parseInt(match[map.YY], 10)
391
+ const y = parseInt(match[ map.YY ], 10)
363
392
  date.year = y < 0 ? y : 2000 + y
364
393
  }
365
394
 
366
395
  if (map.M !== void 0) {
367
- date.month = parseInt(match[map.M], 10)
396
+ date.month = parseInt(match[ map.M ], 10)
368
397
  if (date.month < 1 || date.month > 12) {
369
398
  return date
370
399
  }
371
400
  }
372
401
  else if (map.MMM !== void 0) {
373
- date.month = monthsShort.indexOf(match[map.MMM]) + 1
402
+ date.month = monthsShort.indexOf(match[ map.MMM ]) + 1
374
403
  }
375
404
  else if (map.MMMM !== void 0) {
376
- date.month = months.indexOf(match[map.MMMM]) + 1
405
+ date.month = months.indexOf(match[ map.MMMM ]) + 1
377
406
  }
378
407
 
379
408
  if (map.D !== void 0) {
380
- date.day = parseInt(match[map.D], 10)
409
+ date.day = parseInt(match[ map.D ], 10)
381
410
 
382
411
  if (date.year === null || date.month === null || date.day < 1) {
383
412
  return date
@@ -393,14 +422,14 @@ export function __splitDate (str, mask, dateLocale, calendar, defaultModel) {
393
422
  }
394
423
 
395
424
  if (map.H !== void 0) {
396
- date.hour = parseInt(match[map.H], 10) % 24
425
+ date.hour = parseInt(match[ map.H ], 10) % 24
397
426
  }
398
427
  else if (map.h !== void 0) {
399
- date.hour = parseInt(match[map.h], 10) % 12
428
+ date.hour = parseInt(match[ map.h ], 10) % 12
400
429
  if (
401
- (map.A && match[map.A] === 'PM') ||
402
- (map.a && match[map.a] === 'pm') ||
403
- (map.aa && match[map.aa] === 'p.m.')
430
+ (map.A && match[ map.A ] === 'PM') ||
431
+ (map.a && match[ map.a ] === 'pm') ||
432
+ (map.aa && match[ map.aa ] === 'p.m.')
404
433
  ) {
405
434
  date.hour += 12
406
435
  }
@@ -408,20 +437,20 @@ export function __splitDate (str, mask, dateLocale, calendar, defaultModel) {
408
437
  }
409
438
 
410
439
  if (map.m !== void 0) {
411
- date.minute = parseInt(match[map.m], 10) % 60
440
+ date.minute = parseInt(match[ map.m ], 10) % 60
412
441
  }
413
442
 
414
443
  if (map.s !== void 0) {
415
- date.second = parseInt(match[map.s], 10) % 60
444
+ date.second = parseInt(match[ map.s ], 10) % 60
416
445
  }
417
446
 
418
447
  if (map.S !== void 0) {
419
- date.millisecond = parseInt(match[map.S], 10) * 10 ** (3 - match[map.S].length)
448
+ date.millisecond = parseInt(match[ map.S ], 10) * 10 ** (3 - match[ map.S ].length)
420
449
  }
421
450
 
422
451
  if (map.Z !== void 0 || map.ZZ !== void 0) {
423
- tzString = (map.Z !== void 0 ? match[map.Z].replace(':', '') : match[map.ZZ])
424
- date.timezoneOffset = (tzString[0] === '+' ? -1 : 1) * (60 * tzString.slice(1, 3) + 1 * tzString.slice(3, 5))
452
+ tzString = (map.Z !== void 0 ? match[ map.Z ].replace(':', '') : match[ map.ZZ ])
453
+ date.timezoneOffset = (tzString[ 0 ] === '+' ? -1 : 1) * (60 * tzString.slice(1, 3) + 1 * tzString.slice(3, 5))
425
454
  }
426
455
  }
427
456
 
@@ -501,17 +530,24 @@ export function startOfDate (date, unit, utc) {
501
530
 
502
531
  switch (unit) {
503
532
  case 'year':
504
- t[`${prefix}Month`](0)
533
+ case 'years':
534
+ t[ `${prefix}Month` ](0)
505
535
  case 'month':
506
- t[`${prefix}Date`](1)
536
+ case 'months':
537
+ t[ `${prefix}Date` ](1)
507
538
  case 'day':
508
- t[`${prefix}Hours`](0)
539
+ case 'days':
540
+ case 'date':
541
+ t[ `${prefix}Hours` ](0)
509
542
  case 'hour':
510
- t[`${prefix}Minutes`](0)
543
+ case 'hours':
544
+ t[ `${prefix}Minutes` ](0)
511
545
  case 'minute':
512
- t[`${prefix}Seconds`](0)
546
+ case 'minutes':
547
+ t[ `${prefix}Seconds` ](0)
513
548
  case 'second':
514
- t[`${prefix}Milliseconds`](0)
549
+ case 'seconds':
550
+ t[ `${prefix}Milliseconds` ](0)
515
551
  }
516
552
  return t
517
553
  }
@@ -523,17 +559,24 @@ export function endOfDate (date, unit, utc) {
523
559
 
524
560
  switch (unit) {
525
561
  case 'year':
526
- t[`${prefix}Month`](11)
562
+ case 'years':
563
+ t[ `${prefix}Month` ](11)
527
564
  case 'month':
528
- t[`${prefix}Date`](daysInMonth(t))
565
+ case 'months':
566
+ t[ `${prefix}Date` ](daysInMonth(t))
529
567
  case 'day':
530
- t[`${prefix}Hours`](23)
568
+ case 'days':
569
+ case 'date':
570
+ t[ `${prefix}Hours` ](23)
531
571
  case 'hour':
532
- t[`${prefix}Minutes`](59)
572
+ case 'hours':
573
+ t[ `${prefix}Minutes` ](59)
533
574
  case 'minute':
534
- t[`${prefix}Seconds`](59)
575
+ case 'minutes':
576
+ t[ `${prefix}Seconds` ](59)
535
577
  case 'second':
536
- t[`${prefix}Milliseconds`](999)
578
+ case 'seconds':
579
+ t[ `${prefix}Milliseconds` ](999)
537
580
  }
538
581
  return t
539
582
  }
@@ -568,21 +611,28 @@ export function getDateDiff (date, subtract, unit = 'days') {
568
611
 
569
612
  switch (unit) {
570
613
  case 'years':
614
+ case 'year':
571
615
  return (t.getFullYear() - sub.getFullYear())
572
616
 
573
617
  case 'months':
618
+ case 'month':
574
619
  return (t.getFullYear() - sub.getFullYear()) * 12 + t.getMonth() - sub.getMonth()
575
620
 
576
621
  case 'days':
622
+ case 'day':
623
+ case 'date':
577
624
  return getDiff(startOfDate(t, 'day'), startOfDate(sub, 'day'), MILLISECONDS_IN_DAY)
578
625
 
579
626
  case 'hours':
627
+ case 'hour':
580
628
  return getDiff(startOfDate(t, 'hour'), startOfDate(sub, 'hour'), MILLISECONDS_IN_HOUR)
581
629
 
582
630
  case 'minutes':
631
+ case 'minute':
583
632
  return getDiff(startOfDate(t, 'minute'), startOfDate(sub, 'minute'), MILLISECONDS_IN_MINUTE)
584
633
 
585
634
  case 'seconds':
635
+ case 'second':
586
636
  return getDiff(startOfDate(t, 'second'), startOfDate(sub, 'second'), 1000)
587
637
  }
588
638
  }
@@ -628,26 +678,33 @@ export function isSameDate (date, date2, unit) {
628
678
 
629
679
  switch (unit) {
630
680
  case 'second':
681
+ case 'seconds':
631
682
  if (t.getSeconds() !== d.getSeconds()) {
632
683
  return false
633
684
  }
634
685
  case 'minute': // intentional fall-through
686
+ case 'minutes':
635
687
  if (t.getMinutes() !== d.getMinutes()) {
636
688
  return false
637
689
  }
638
690
  case 'hour': // intentional fall-through
691
+ case 'hours':
639
692
  if (t.getHours() !== d.getHours()) {
640
693
  return false
641
694
  }
642
695
  case 'day': // intentional fall-through
696
+ case 'days':
697
+ case 'date':
643
698
  if (t.getDate() !== d.getDate()) {
644
699
  return false
645
700
  }
646
701
  case 'month': // intentional fall-through
702
+ case 'months':
647
703
  if (t.getMonth() !== d.getMonth()) {
648
704
  return false
649
705
  }
650
706
  case 'year': // intentional fall-through
707
+ case 'years':
651
708
  if (t.getFullYear() !== d.getFullYear()) {
652
709
  return false
653
710
  }
@@ -705,12 +762,12 @@ const formatter = {
705
762
 
706
763
  // Month Short Name: Jan, Feb, ...
707
764
  MMM (date, dateLocale) {
708
- return dateLocale.monthsShort[date.getMonth()]
765
+ return dateLocale.monthsShort[ date.getMonth() ]
709
766
  },
710
767
 
711
768
  // Month Name: January, February, ...
712
769
  MMMM (date, dateLocale) {
713
- return dateLocale.months[date.getMonth()]
770
+ return dateLocale.months[ date.getMonth() ]
714
771
  },
715
772
 
716
773
  // Quarter: 1, 2, 3, 4
@@ -760,12 +817,12 @@ const formatter = {
760
817
 
761
818
  // Day of week: Sun, Mon, ...
762
819
  ddd (date, dateLocale) {
763
- return dateLocale.daysShort[date.getDay()]
820
+ return dateLocale.daysShort[ date.getDay() ]
764
821
  },
765
822
 
766
823
  // Day of week: Sunday, Monday, ...
767
824
  dddd (date, dateLocale) {
768
- return dateLocale.days[date.getDay()]
825
+ return dateLocale.days[ date.getDay() ]
769
826
  },
770
827
 
771
828
  // Day of ISO week: 1, 2, ..., 7
@@ -914,7 +971,7 @@ export function formatDate (val, mask, dateLocale, __forcedYear, __forcedTimezon
914
971
  token,
915
972
  (match, text) => (
916
973
  match in formatter
917
- ? formatter[match](date, locale, __forcedYear, __forcedTimezoneOffset)
974
+ ? formatter[ match ](date, locale, __forcedYear, __forcedTimezoneOffset)
918
975
  : (text === void 0 ? match : text.split('\\]').join(']'))
919
976
  )
920
977
  )