質問編集履歴
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -305,3 +305,151 @@
|
|
305
305
|
- isLeapMonth : false
|
306
306
|
|
307
307
|
```
|
308
|
+
|
309
|
+
###追記2
|
310
|
+
|
311
|
+
dateからdateComponentsに変換した場合とdateComponents決め打ちの場合で
|
312
|
+
|
313
|
+
両方デバッグ出力して比較してみましたが、dateからdateComponentsに変換した場合は
|
314
|
+
|
315
|
+
色々と付加情報がついていたので、憶測でしかないですがこの辺りが怪しい気がします。
|
316
|
+
|
317
|
+
```
|
318
|
+
|
319
|
+
//通知飛んで来ない
|
320
|
+
|
321
|
+
//2019/1/30 23:05 実行
|
322
|
+
|
323
|
+
let calendar = Calendar.current
|
324
|
+
|
325
|
+
let date = Date()
|
326
|
+
|
327
|
+
let after = calendar.date(byAdding: .minute, value: 1, to: date)!
|
328
|
+
|
329
|
+
let dateComponents = Calendar.current.dateComponents(in: .current, from: after)
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
(lldb) po dateComponents
|
334
|
+
|
335
|
+
▿ calendar: gregorian (current) timeZone: Asia/Tokyo (current) era: 1 year: 2019 month: 1 day: 30 hour: 23 minute: 6 second: 8 nanosecond: 585582017 weekday: 4 weekdayOrdinal: 5 quarter: 0 weekOfMonth: 5 weekOfYear: 5 yearForWeekOfYear: 2019 isLeapMonth: false
|
336
|
+
|
337
|
+
▿ calendar : gregorian (current)
|
338
|
+
|
339
|
+
- identifier : Foundation.Calendar.Identifier.gregorian
|
340
|
+
|
341
|
+
- kind : "current"
|
342
|
+
|
343
|
+
▿ locale : Optional<Locale>
|
344
|
+
|
345
|
+
▿ some : en_JP (current)
|
346
|
+
|
347
|
+
- identifier : "en_JP"
|
348
|
+
|
349
|
+
- kind : "current"
|
350
|
+
|
351
|
+
▿ timeZone : Asia/Tokyo (current)
|
352
|
+
|
353
|
+
- identifier : "Asia/Tokyo"
|
354
|
+
|
355
|
+
- kind : "current"
|
356
|
+
|
357
|
+
▿ abbreviation : Optional<String>
|
358
|
+
|
359
|
+
- some : "JST"
|
360
|
+
|
361
|
+
- secondsFromGMT : 32400
|
362
|
+
|
363
|
+
- isDaylightSavingTime : false
|
364
|
+
|
365
|
+
- firstWeekday : 1
|
366
|
+
|
367
|
+
- minimumDaysInFirstWeek : 1
|
368
|
+
|
369
|
+
▿ timeZone : Asia/Tokyo (current)
|
370
|
+
|
371
|
+
- identifier : "Asia/Tokyo"
|
372
|
+
|
373
|
+
- kind : "current"
|
374
|
+
|
375
|
+
▿ abbreviation : Optional<String>
|
376
|
+
|
377
|
+
- some : "JST"
|
378
|
+
|
379
|
+
- secondsFromGMT : 32400
|
380
|
+
|
381
|
+
- isDaylightSavingTime : false
|
382
|
+
|
383
|
+
- era : 1
|
384
|
+
|
385
|
+
- year : 2019
|
386
|
+
|
387
|
+
- month : 1
|
388
|
+
|
389
|
+
- day : 30
|
390
|
+
|
391
|
+
- hour : 23
|
392
|
+
|
393
|
+
- minute : 6
|
394
|
+
|
395
|
+
- second : 8
|
396
|
+
|
397
|
+
- nanosecond : 585582017
|
398
|
+
|
399
|
+
- weekday : 4
|
400
|
+
|
401
|
+
- weekdayOrdinal : 5
|
402
|
+
|
403
|
+
- quarter : 0
|
404
|
+
|
405
|
+
- weekOfMonth : 5
|
406
|
+
|
407
|
+
- weekOfYear : 5
|
408
|
+
|
409
|
+
- yearForWeekOfYear : 2019
|
410
|
+
|
411
|
+
- isLeapMonth : false
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
-------------------------------------------------------------------------------
|
416
|
+
|
417
|
+
//通知飛んで来る
|
418
|
+
|
419
|
+
//2019/1/30 23:06 実行
|
420
|
+
|
421
|
+
var dateComponents = DateComponents()
|
422
|
+
|
423
|
+
dateComponents.year = 2019
|
424
|
+
|
425
|
+
dateComponents.month = 1
|
426
|
+
|
427
|
+
dateComponents.day = 30
|
428
|
+
|
429
|
+
dateComponents.hour = 23
|
430
|
+
|
431
|
+
dateComponents.minute = 7
|
432
|
+
|
433
|
+
dateComponents.second = 0
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
(lldb) po dateComponents
|
438
|
+
|
439
|
+
▿ year: 2019 month: 1 day: 30 hour: 23 minute: 7 second: 0 isLeapMonth: false
|
440
|
+
|
441
|
+
- year : 2019
|
442
|
+
|
443
|
+
- month : 1
|
444
|
+
|
445
|
+
- day : 30
|
446
|
+
|
447
|
+
- hour : 23
|
448
|
+
|
449
|
+
- minute : 7
|
450
|
+
|
451
|
+
- second : 0
|
452
|
+
|
453
|
+
- isLeapMonth : false
|
454
|
+
|
455
|
+
```
|
3
dateComponentsの中身を出力したものを記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -217,3 +217,91 @@
|
|
217
217
|
}
|
218
218
|
|
219
219
|
```
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
###追記
|
224
|
+
|
225
|
+
```
|
226
|
+
|
227
|
+
(lldb) po dateComponents
|
228
|
+
|
229
|
+
▿ calendar: gregorian (current) timeZone: Asia/Tokyo (current) era: 1 year: 2019 month: 1 day: 30 hour: 22 minute: 52 second: 29 nanosecond: 591760039 weekday: 4 weekdayOrdinal: 5 quarter: 0 weekOfMonth: 5 weekOfYear: 5 yearForWeekOfYear: 2019 isLeapMonth: false
|
230
|
+
|
231
|
+
▿ calendar : gregorian (current)
|
232
|
+
|
233
|
+
- identifier : Foundation.Calendar.Identifier.gregorian
|
234
|
+
|
235
|
+
- kind : "current"
|
236
|
+
|
237
|
+
▿ locale : Optional<Locale>
|
238
|
+
|
239
|
+
▿ some : en_JP (current)
|
240
|
+
|
241
|
+
- identifier : "en_JP"
|
242
|
+
|
243
|
+
- kind : "current"
|
244
|
+
|
245
|
+
▿ timeZone : Asia/Tokyo (current)
|
246
|
+
|
247
|
+
- identifier : "Asia/Tokyo"
|
248
|
+
|
249
|
+
- kind : "current"
|
250
|
+
|
251
|
+
▿ abbreviation : Optional<String>
|
252
|
+
|
253
|
+
- some : "JST"
|
254
|
+
|
255
|
+
- secondsFromGMT : 32400
|
256
|
+
|
257
|
+
- isDaylightSavingTime : false
|
258
|
+
|
259
|
+
- firstWeekday : 1
|
260
|
+
|
261
|
+
- minimumDaysInFirstWeek : 1
|
262
|
+
|
263
|
+
▿ timeZone : Asia/Tokyo (current)
|
264
|
+
|
265
|
+
- identifier : "Asia/Tokyo"
|
266
|
+
|
267
|
+
- kind : "current"
|
268
|
+
|
269
|
+
▿ abbreviation : Optional<String>
|
270
|
+
|
271
|
+
- some : "JST"
|
272
|
+
|
273
|
+
- secondsFromGMT : 32400
|
274
|
+
|
275
|
+
- isDaylightSavingTime : false
|
276
|
+
|
277
|
+
- era : 1
|
278
|
+
|
279
|
+
- year : 2019
|
280
|
+
|
281
|
+
- month : 1
|
282
|
+
|
283
|
+
- day : 30
|
284
|
+
|
285
|
+
- hour : 22
|
286
|
+
|
287
|
+
- minute : 52
|
288
|
+
|
289
|
+
- second : 29
|
290
|
+
|
291
|
+
- nanosecond : 591760039
|
292
|
+
|
293
|
+
- weekday : 4
|
294
|
+
|
295
|
+
- weekdayOrdinal : 5
|
296
|
+
|
297
|
+
- quarter : 0
|
298
|
+
|
299
|
+
- weekOfMonth : 5
|
300
|
+
|
301
|
+
- weekOfYear : 5
|
302
|
+
|
303
|
+
- yearForWeekOfYear : 2019
|
304
|
+
|
305
|
+
- isLeapMonth : false
|
306
|
+
|
307
|
+
```
|
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|